Skip to main content

The Event Loop, Call Stack and Task Queues

Learn The Event Loop, Call Stack and Task Queues (Phase 8 · Promises, async/await, Event Loop (Essential), JavaScript) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

One thread, many tasks • JavaScript runs your code on a single call stack . Long synchronous work freezes the page because nothing else can run. • Asynchronous operations (timers, network, events) are handled by the environment (browser/Node); when they finish, their callbacks are queued. • The event loop pushes a queued callback onto the stack only when the stack is empty.

More lessons in Phase 8 · Promises, async/await, Event Loop (Essential)