maps in javacsript array code example
Example: how the map function works javascript
const array = [2, 5, 9];
let squares = array.map((num) => num * num);
console.log(array); // [2, 5, 9]
console.log(squares); // [4, 25, 81]
const array = [2, 5, 9];
let squares = array.map((num) => num * num);
console.log(array); // [2, 5, 9]
console.log(squares); // [4, 25, 81]