What is the precise behavior of the Event Loop when a Promise microtask is queued during the execution of a synchronous task?

Web Development Hard

Web Development — Hard

What is the precise behavior of the Event Loop when a Promise microtask is queued during the execution of a synchronous task?

Key points

  • Microtasks execute after the call stack clears.
  • Microtasks have higher priority than macrotasks.
  • The entire microtask queue is drained before the next event loop phase.

Ready to go further?

Related questions