JavaScript · Junior · Question 22 of 75
What does [1, 2, 3].map(x => x * 2) return?
- ✓Correct answer:
[2, 4, 6] - 2
undefined - 3
12
Explanation
map creates a new array from the callback's results without changing the original. Similar non-mutating methods: filter (selection), reduce (folding into one value), find, some, every.