Skip to main content
Output PredictionJS JavaScript Hard+35 XP

Closure Trap

What does this log?

JavaScript
for (var i = 0; i < 3; i++) {
  setTimeout(() => console.log(i), 0);
}
// Output after all timeouts:

🔮 What is the output?