Event Loop

The Event Loop

The loop that ties it together: whenever the call stack is empty, it drains all microtasks, then takes one task from the queue and runs it. Repeat forever.

Stack empties → microtasks drain → one task runs → stack empties → repeat.

↻
Task Queue
task
Call Stack
Stack empty → take the next task → repeat

Tap the example to replay it · press and hold to slow it down

One of 40 cards in javascript flashcards. Browse every card.