In brief
map() creates a new array of results per function. It is appropriate when we want a new value from each input element.
Useful to know
To get a new list of changed values, use map(). The method calls a specified function for the elements of the array and collects the returned results in a new array. Invocation itself does not mean that the input objects are deeply copied. [1]
Example: const prices = [12, 20, 8]; const discounted = prices.map(price => price * 0.9);. The result is [10.8, 18, 7.2]. Values are conditional; the example calculates a decrease of 10%, without currency rules and rounding. The initial array remains [12, 20, 8] because the function returns numbers without changing it.
A common error is a function with curly brackets without return: prices.map(price => { price * 0.9; }). It returns undefined for each item. If the target is only a side effect, such as a record in the console, and the new array will not be used, use a loop instead of map(). [1]
Sources
For further detail and to check the information: