In JavaScript, the .map()
method allows you to create a new array by returning the results of calling a function that you provide on every element in a given array.
const numbers = [1, 2, 3, 4, 5]
const squared = numbers.map((num) => num * num)
console.log(squared)