JS

JavaScript ES6 - Arrow function map code example

29.

What is the output of the following code?

const numbers = [1, 2, 3, 4, 5];

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

console.log(squaredNumbers);

[1, 3, 5, 7, 9]

[2, 4, 6, 8, 10]

[1, 2, 3, 4, 5]

[1, 4, 9, 16, 25]