cf.completefrontend

Predict the outputEasy

What do these two loops log when each one schedules a setTimeout per iteration?

What does this log?
for (var i = 0; i < 3; i++) {
  setTimeout(() => console.log("var", i), 0);
}
 
for (let j = 0; j < 3; j++) {
  setTimeout(() => console.log("let", j), 0);
}

The answer

Work out every line it logs, in order. Then check.

Checking your sign-in…