Event Loop

Blocking the Main Thread

Long synchronous work keeps a frame on the stack, so the loop can't reach queued tasks or repaint. Clicks, animations, and rendering all freeze until it finishes.

A heavy while-loop makes the page unresponsive until it's done.

UI: live
Call Stack
Task Queue
Long sync work freezes the page

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

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