Free · no signupPromise vs setTimeout: who logs first?
2. Predict the output. 3. Check it and step through.
Predict the console output
Read from top to bottom. Each log prints on its own line.
console.log("start");
setTimeout(() => {
console.log("timer");
}, 0);
Promise.resolve().then(() => {
console.log("promise");
});
console.log("end");
Step through the event loop
Your turn first! Choose an output and check your prediction to unlock the queues and execution trace.
Free, no signup. Three fixed, tested teaching examples—not a code runner. Predictions stay in page memory and clear on reload. No submitted code or saved results. The trace models an isolated browser script with fulfilled Promises and one timer, not every event-loop phase or unrelated browser work.