Puzzle 8 of 15 · map
Read a map callback that doubles numbers, then compare logs of the original array and the returned array. Predict both lines. Choose an output below, then check the explanation. No signup needed. Browse puzzles by topic →
1const nums = [1, 2, 3]; 2const doubled = nums.map(n => n * 2); 3console.log(nums.join(",")); 4console.log(doubled.join(","));
Predict the console output. Each line is a separate log.
2,4,6 2,4,6
1,2,3 1,2,3
1,2,3 2,4,6
2,4,6 1,2,3