JavaScript Output Prediction Medium +20 XP
Array Destructuring
What gets logged?
JavaScriptRead-only
const [a, , b] = [1, 2, 3, 4]; console.log(a, b);
What is the output?
Show answer and explanation
Answer: 1 3
The empty slot (,,) skips the second element. So a=1, b=3.
Hint: The comma skips an element.
What this challenge tests
Output Prediction in JavaScript: destructuring, arrays.