IT lexicon › Programming › Event loop

Event loop

Programming På svenska → Updated: 2026-07-30

The mechanism that makes JavaScript single-threaded yet async — runs one thing at a time, checks the queue between iterations.

When you fetch(), the callback goes on the queue. The event loop picks the next one when the current finishes. Block the thread (heavy loop) — everything freezes. The microtask queue (Promises) is prioritised over macrotask (setTimeout).

← Back to the lexicon