Creates a new array with the results of calling a function on every element.
Syntax
arr.map(callbackFn)Example
Enter values below to update the example in real time.
const→numbers→doubled→map→console→const numbers = [1, 2, 3, 4, 5];
const doubled = numbers.map((n) => n * 2);
console.log(doubled); // [2, 4, 6, 8, 10]