20.
What will be the value of "doubledNumbers" after executing the following code?
const numbers = [1, 2, 3, 4, 5];
const doubledNumbers = numbers.map(function(number) {
return number * 2;
});
console.log(doubledNumbers);
[2, 3, 4, 5]
[1, 4, 6, 8, 10]
[1, 2, 3, 4, 5]
[2, 4, 6, 8, 10]
Correct: D
The map() method applies the provided function to each element in the numbers array and returns a new array with the modified values. In this case, the function multiplies each number by 2. Therefore, the value of doubledNumbers will be [2, 4, 6, 8, 10].