← Back to Arrays
Question 31
map: Double Each Number
map: Double Each Number
Use map to create a new array where each number is doubled, then print the result as comma-separated values.
Array:
[1, 2, 3, 4]
Steps:
1. Use map on the provided numbers array
2. Return each number multiplied by 2
3. Print the new array using join(',')Expected Output:
2,4,6,8= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
LoopsArraysmap
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.