โ Back to Loops
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]
Expected output:
2,4,6,8
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
Topics:
LoopsArraysmap
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.