JavaScript·Intermediate·Conceptual·1 min read
What is the difference between a task and a microtask?
Short interview answer
Tasks include events, timers, and initial script execution. Promise reactions and queueMicrotask callbacks are microtasks. After a task finishes, the microtask queue is drained before the next task; continually adding microtasks can therefore delay rendering and input.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.