map()
noun
say it: “MAP” /mæp/
The JavaScript array method that turns each item into something else, giving a new array.
What does map() do in JavaScript?
map() — An Array method that creates a new array by transforming every item.
const prices = [2, 3, 4];
const doubled = prices.map(price => price * 2);
In a sentence
- “products.map(p => p.name) gave an array of just the names.”
Level: Journeyman · More JavaScript terms at this level
Updated