JavaScript Event Loop Explorer

Step through a sample program and watch the call stack, microtask queue (Promise callbacks) and macrotask queue (setTimeout callbacks) fill and drain. The order of the console output stops being mysterious once you can see the machine that produces it.

Program
Run
Speed
Step 1 / 1
Idle
Source

    
Call Stack LIFO · top runs
Microtasks FIFO · promises
Macrotasks FIFO · timers
⚡ When the stack empties, every microtask runs before one macrotask is taken — then microtasks drain again. That priority rule is the whole trick.
Console output order of appearance
Prompt — take this scenario back to Claude

Keys: step · Space play/pause · Home reset