16.
What will be the output of the following code?
let numbers = [10, 20, 30, 40, 50];
let squareNumbers = numbers.map(function(number) {
return number * number;
});
console.log(squareNumbers);
[100, 400, 900, 1600, 2500, 10, 20, 30, 40, 50]
[100, 400, 900, 1600, 2500, 100, 400, 900, 1600, 2500]
[100, 400, 900, 1600, 2500]
[10, 20, 30, 40, 50]
Correct: C
The map() method applies the provided function to each element in the array and returns a new array with the results. In this case, the provided function calculates the square of each number in the numbers array. So, the output will be [100, 400, 900, 1600, 2500].