Lab · Runtime
Event Loop Visualizer
Why does a Promise callback run before a setTimeout(…, 0)? Step through real snippets and watch the call stack, microtask queue, and macrotask queue move — the exact ordering the runtime guarantees.
demonstrates: deep runtime understanding
1console.log('A');2setTimeout(() => console.log('B'), 0);3Promise.resolve().then(() => console.log('C'));4console.log('D');
console
—
Call stack
- main()
Microtasks
- empty
Macrotasks
- empty
Script enters the call stack and begins executing top to bottom.
step 1/10