Skip to content

Microtask and Macrotask Queues

JavaScript has two task queues: microtasks (high priority) and macrotasks (lower priority). The event loop processes all microtasks before moving to the next macrotask.

Microtasks run before the next macrotask. Microtask queue is fully cleared each cycle. Promise callbacks are microtasks.