Javascript Array Map Example
A simple demonstration of how to use the map function in Javascript.
06/03/2026
JavaScript
const numbers = [1, 4, 9];
const roots = numbers.map((num) => Math.sqrt(num));
// roots is now [1, 2, 3]
// numbers is still [1, 4, 9]
console.log(roots);