Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

JS Puzzles · Const

Microtask Queue

The microtask queue is the internal PromiseJobs queue used for promise handlers. Handlers are queued asynchronously and run in FIFO order after the current synchronous code finishes.

How it works

JavaScript stores ready promise handlers in the internal PromiseJobs queue, commonly called the microtask queue. The engine runs queued handlers only after the current synchronous code has finished, taking them in FIFO order; chained handlers are queued and therefore remain asynchronous.

Key points

  • The standard’s internal PromiseJobs queue is commonly known as the microtask queue.
  • Microtasks use FIFO ordering: the first handler placed in the queue is the first one taken out.
  • A ready promise schedules its then, catch, and finally handlers instead of invoking them immediately.
  • Queued promise work starts after the engine has finished the currently running synchronous code.
  • Promise callbacks run after the current code, including when the promise was already settled.

Common mistakes

  • Even an already-settled promise does not call its then, catch, or finally handler synchronously.
  • Every handler in a promise chain is scheduled asynchronously rather than executing as part of the same synchronous call.

Example: Promise handlers run through the microtask queue

Promise.resolve().then(() => console.log("microtask"));
console.log("synchronous");

The synchronous log runs first; the promise handler runs after the current code finishes.

When to use it

Promise callbacks

Deferring promise reactions until synchronous work completes.

Promise-chain debugging

Understanding the order of chained then, catch, and finally handlers.

Asynchronous control flow

Explaining why settled promises still invoke callbacks later.

Interview questions

QWhen does a promise then handler execute?

Promise handlers are placed in the internal PromiseJobs queue, also called the microtask queue. They run only after the current synchronous code has completed.

Follow-up: What ordering does the queue use? It is FIFO, so the earliest enqueued handler runs first.

QHow are microtasks ordered and started?

The queue is first-in-first-out: handlers added first are executed first. A queued handler runs only when the engine is no longer executing other code.

Follow-up: Does an already fulfilled promise make its handler synchronous? No; promise handling always passes through the microtask queue.

QWhat happens with multiple handlers in a promise chain?

Each handler in a chain is queued independently, so every then, catch, or finally callback remains asynchronous. A later handler waits until earlier queued work and the preceding chain step have completed.

Follow-up: Why can a chain appear sequential? Each callback returns a promise whose settlement queues the next handler.

  • Promise
  • then()
  • catch()
  • finally()
  • PromiseJobs
  • event loop
  • await

Source: Microtasks (Microtasks). Checked 2026-10-15.