MediumArray Methods💻 Output Question

Array destructuring with skip and rest

💡

Hint

Destructuring supports skipping (empty comma) and rest to collect remaining elements.

What does this output?

const [first, , third, ...rest] = [1, 2, 3, 4, 5];
console.log(first);
console.log(third);
console.log(rest.join(','));

Correct Output

1
3
4,5

Why this output?

Explanation: first=1, second skipped, third=3, rest=[4,5].

Key Insight: Destructuring supports skipping (empty comma) and rest to collect remaining elements.

More Array Methods Output Questions

Easymap transforms each elementMediumfilter then map chainMediumreduce accumulates to a single valueMediumfind returns first match; filter returns all

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz