FrontendInterviews.dev

603. Closure in Loop with setTimeout

Easy•

What does this log?

for (var i = 0; i < 3; i++) {
  setTimeout(() => console.log(i), 0)
}

What is printed?

Select an option and submit your answer.
Next Problem