← React Intermediate Questions - Set 6 Q56

What is the difference between `map` and `forEach` in JavaScript?

React Intermediate Questions - Set 6

Example

items.map(i => i.id);        // returns a new array
items.forEach(i => log(i));  // returns undefined

What to notice

← Back to the question list