Event Loop

Microtask Starvation

Because microtasks fully drain before anything else, a microtask that keeps scheduling more microtasks never lets the loop reach the task queue or a render — starving them.

A .then() that always schedules another .then() blocks all timers and painting.

Microtask Q
.then()
Call Stack
Task Queue
render ⏳
Endless microtasks starve the task queue

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

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