MediumEvent Loop & Promises💻 Output Question

setTimeout fires in delay order

💡

Hint

setTimeout fires after AT LEAST the specified delay, ordered by when they expire.

What does this output?

setTimeout(() => console.log('c'), 100);
setTimeout(() => console.log('a'), 0);
setTimeout(() => console.log('b'), 50);

Correct Output

a
b
c

Why this output?

Explanation: Timers fire after their delay expires. 0ms → a, 50ms → b, 100ms → c.

Key Insight: setTimeout fires after AT LEAST the specified delay, ordered by when they expire.

More Event Loop & Promises Output Questions

EasySynchronous code runs before setTimeoutMediumPromise microtask before setTimeout macrotaskMediumPromise chain passes valuesHardTwo Promise chains interleave in microtask queue

Practice predicting output live →

66 output questions with instant feedback

💻 Try Output Quiz