Map
The map
method iterates over an array and modifies its elements using a callback function. The callback function will then be applied to each element of the array.
Here, the map
method returns a new array with the results and preserves the old one. To assign this, a new variable is used.
Last updated
Was this helpful?