HardEvent Loop & Promises💻 Output Question

Two Promise chains interleave in microtask queue

💡

Hint

Multiple Promise chains interleave by round-robin. Each .then schedules the NEXT .then — they don't all run back-to-back.

What does this output?

Promise.resolve()
  .then(() => console.log(1))
  .then(() => console.log(2));

Promise.resolve()
  .then(() => console.log(3))
  .then(() => console.log(4));

Correct Output

1
3
2
4

Why this output?

Explanation: After sync code, both first .then callbacks are queued (1 and 3). After 1 runs, 2 is queued. Then 3 runs, queueing 4. Then 2, then 4.

Key Insight: Multiple Promise chains interleave by round-robin. Each .then schedules the NEXT .then — they don't all run back-to-back.

More Event Loop & Promises Output Questions

EasySynchronous code runs before setTimeoutMediumPromise microtask before setTimeout macrotaskMediumPromise chain passes valuesMediumawait suspends function — caller continues

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz