Glossary coding Term Page
Microtask Queue
Queue for Promise reactions, queueMicrotask, and MutationObserver callbacks between a task and the next turn.
Core Idea
After synchronous code finishes, the event loop empties the microtask queue before touching timers or paint. Anything scheduled via Promise.then, async/await, MutationObservers, or queueMicrotask runs here, giving you a chance to flush UI state within the same frame.
Why It Matters Here
Mathbong leans on the microtask queue to coalesce renders and debounce state writes. By finishing microtasks before the macrotask queue and paint, the lessons show how to keep scroll and input handlers responsive even while promises chain up.