Array Map Return
Multiple Choice Easy
Question
What does [1,2].map(x => x*2) return?
Hint
map creates a new array with transformed values.
Explanation
[1,2].map(x => x*2) applies the function to each element, returning a new array [2, 4]. The original array is not modified. map always returns a new array of the same length. It is one of the most useful array methods for data transformation.
Related Resources
Related Lessons
- Arrays
Learn JS arrays.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.