Using Array.map to produce values

Other array operations are intended to produce new values. This can be a property from array elements or any other value calculated for each. The map method visits each element and collects the values into a new array.

In this recipe, we'll take a look at how to use map to create an array of new values.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.