Create a new array by transforming each element:
let numbers = [1, 2, 3, 4]
let doubled = numbers.map(n => n * 2)
console.log(doubled) // [2, 4, 6, 8]
let names = ["alice", "bob"]
let upper = names.map(name => name.toUpperCase())
console.log(upper) // ["ALICE", "BOB"]
The callback receives each element and returns the transformed value. The result is a new array of the same length.