Answers for "map function demo"

5

map function demo

const array = [2, 5, 9];
let squares = array.map((num) => num * num);

console.log(array); // [2, 5, 9]
console.log(squares); // [4, 25, 81]
Posted by: Guest on April-07-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language