EasyArray Methods💻 Output Question

map transforms each element

💡

Hint

map always returns a new array of the same length. It transforms without mutating.

What does this output?

const nums = [1, 2, 3, 4, 5];
console.log(nums.map(n => n * n).join(','));

Correct Output

1,4,9,16,25

Why this output?

Explanation: map creates a new array by applying the callback to each element.

Key Insight: map always returns a new array of the same length. It transforms without mutating.

More Array Methods Output Questions

Mediumfilter then map chain→Mediumreduce accumulates to a single value→Mediumfind returns first match; filter returns all→Mediumreduce to build a frequency object→

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz