Event Loop

Task Queue (Macrotasks)

Where finished callbacks (setTimeout, DOM events) wait their turn. It's FIFO — first in, first out. One task runs to completion before the next is picked up.

Two setTimeout callbacks fire in the order they were queued.

Task Queue
cb1
cb2
cb3
Call Stack
FIFO — first in, first out

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

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