Event Loop

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

One of 40 cards in the JavaScript deck. Browse every card.