Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardNodeJSmicrotasks vs timer phaseSingle-choice MCQ

After an fs.readFile callback runs in the poll phase, this block schedules four things. What is the exact output order and why?

const fs = require('fs'); fs.readFile(__filename, () => { setTimeout(() => console.log('timeout'), 0); setImmediate(() => console.log('immediate')); process.nextTick(() => console.log('nextTick')); Promise.resolve().then(() => console.log('promise')); });