map syntax code example
Example 1: array map javascript
const array1 = [1, 4, 9, 16];
const map1 = array1.map(x => x * 2);
console.log(map1);
Example 2: map()
The map() method creates a new array populated with the results of calling
a provided function on every element in the calling array.
const array1 = [1, 4, 9, 16];
const map1 = array1.map(x => x * 2);
console.log(map1);
Example 3: javascript map
array.map( item => item.id )
array2.map( item => item.toString() )
array2.map( item => item * 3 )