cf.completefrontend

Predict the outputEasy

Does setTimeout(fn, 0) run fn before the next line? What does this log?

What does this log?
console.log("start");
setTimeout(() => console.log("timeout"), 0);
for (let i = 1; i <= 3; i++) {
  console.log("loop", i);
}
console.log("end");

The answer

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

Checking your sign-in…