When JavaScript takes its coffee break?
summary
Explains exact mechanics: call stack → Web API → queue with demos that show a zero-delay setTimeout taking ≈4ms and promises (microtasks) running before timers. Shows three live animations so microtasks freeze the main thread while requestAnimationFrame runs at screen refresh (requestAnimationFrame 60Hz), and setTimeout fires about 166× per second in the demo versus 60 for RAF (microtask vs task priority). Mentions QMicrotask API, Node process.nextTick and the new scheduler API, and using the performance tab to debug.
AI-written summary · about
chapters (14)
- 0:00JavaScript event loop intro
- 2:45Single-threaded JS basics
- 4:51Async tasks in event loop
- 8:45Render timing with event loop
- 10:07Microtask vs task priority
- 13:48Promise order in event loop
- 15:59Blocking main thread
- 17:23Task vs microtask queues
- 18:49Animation frame rate
- 19:53Demo: task types in animation
- 23:07Microtask function tips
- 24:35Event loop in frameworks
- 25:39Learning event loop
- 26:46JS spec and event loop








