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

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