Explore Library
Quiz

Await Continuation Microtask Ordering

Predict the log order when async/await, promises, and setTimeout interact through the event loop.

What is the exact console output order of this code? console.log('1'); setTimeout(() => console.log('2'), 0); async function foo() { console.log('3'); await Promise.resolve(); console.log('4'); } foo(); Promise.resolve().then(() => console.log('5')); console.log('6');