Map array of objects

The map method allows us to iterate over every value in an array and execute a function on it. It creates a new array in the process, does not execute on empty objects and doesn't modify our original array. Array.map() takes a function asthe only parameter that will be executed on every element of our array.

Syntax

const numbers = [1, 40, 80, 100];

const numbersTimesTwo = numbers.map(number => number * 2);
JavaScript