Array.prototype.map() - JavaScript | MDN

PHOTO EMBED

Tue Mar 09 2021 07:25:16 GMT+0000 (UTC)

Saved by @ahmet_dogramaci

const array1 = [1, 4, 9, 16];

// pass a function to map
const map1 = array1.map(x => x * 2);

console.log(map1);
// expected output: Array [2, 8, 18, 32]
content_copyCOPY

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map