map method, which can be run on any array, takes a callback function as the only argument to pass in. That function will be called once for each item in the array, and the function will have access to that item. The purpose of the
map method is to change the data in some form, and a new array will be returned. Here's an example of taking an array of numbers and multiplying each number by 2:
const numbers = [1, 2, 3]; const multipliedBy2 = numbers.map(num => num * 2); console.log(multipliedBy2); // [2, 4, 6];
In this example, the callback function provided is an arrow function that uses implicit return to return the number multiplied by two for each item in the array.