Javascripts map
Kevin Beck
—May 08, 2020
"The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.
You shouldn't be using the map() method if:
you're not using the array it returns; and/or you're not returning a value from the callback." MDN
const array1 = [1, 4, 9, 16];// pass an arrow function (times each value by two) to mapconst array2 = array1.map(x => x * 2);console.log(array2);// expected output: Array [2, 8, 18, 32]