Javascript .map() method
By: Daniel Jimenez | Published on: Aug 03 2020
#Javascript
#Methods
#.map
#ES6
I remember when I started working with React and I kept seeing this .map() method everywhere.
The .map() method takes each element in an array and transforms it with a function, the map method then returns an array with the same number of items in which it began.
Here we have an array with different Avengers... and Hawkeye

Here I created a quick function that will .map() though my list of Avengers and it will return a list with the Avenger and the text "is an Avenger"

And here is my result, I passed an array with 6 items and it returned a new array with 6 items.

Want to see a live Preview? Check out the CodePen
Share:
