Leaderboard Archive
Javascript Apr 7, 2026

What gets logged to the console?

for(var i = 0; i < 3; i++) {
  setTimeout(() => console.log(i), 0)
}
The Correct Answer
B
Explanation
var is function-scoped. By the time setTimeout fires (after the loop), i = 3. Fix: replace var with let.

Ready for your shot?

Join thousands of developers solving one logic puzzle every morning.

Solve Today's Challenge →