Event Loop

Web APIs

Browser-provided features (timers, fetch, DOM events) that run outside the JS engine. You hand them work and a callback; they run it on their own and hand the callback back when done — so the stack stays free.

setTimeout hands the timer to the browser; your callback comes back later.

Call Stack
setTimeout()
Web APIs
Task Queue
Async work runs off the stack

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

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