Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaScriptmicrotask vs macrotask orderingSingle-choice MCQ

What does this log, given that the microtask queue is fully drained between macrotasks and chained .then reactions are only enqueued once their predecessor settles?

console.log(1); setTimeout(() => console.log(2), 0); Promise.resolve().then(() => console.log(3)) .then(() => console.log(4)); queueMicrotask(() => console.log(5)); console.log(6);