Answer
map() returns a new array built from the return value of the callback for each element; forEach() only runs the callback for its side effects and always returns undefined.
const doubled = [1,2,3].map(n => n*2); // [2,4,6]Real-world example Transforming an array of user objects into an array of display names.