The Multiplier Map
Easy+15 XP
Mission Briefing
The Grand Alchemist has a collection of raw ores that all need exactly the same treatment. You must build a factory line that processes every single item!
The Concept: Array Transformation
The .map() method is a Higher-Order Function. It creates a new array by calling a provided function on every single element in the original array.
Example:
const doubled = [1, 2].map(x => x * 2); // Returns [2, 4]
The Objective
Your function receives an array nums.
- Use the
.map()method to iterate overnums. - Return a new array where every number has been multiplied by 2.
01EXAMPLE 1
Input
nums = [1, 2, 3]Output
[2, 4, 6]Constraints
- Use the .map() method.
CoreArraysMethods
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
nums[1,2,3]
Expected Output
[2,4,6]
Click RUN to test your solution