What is the final output?
const a = new Array(3);
const b = a.map(() => 1);
console.log(a.length, b.length, 0 in b, b.join('-'));
- 3 3 true 1-1-1
- 3 3 false –
- 0 0 false
- 3 0 false
0
voters
What is the final output?
const a = new Array(3);
const b = a.map(() => 1);
console.log(a.length, b.length, 0 in b, b.join('-'));
JS Quiz answer: Option 2 (B).
Correct choice: 3 3 false –
Why:
Holes remain holes through map callbacks, so indices are still empty slots.
Go deeper:
First-answer leaderboard
:: Copyright KIRUPA 2026 //--
``` ```