Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumNodeJSprocess.nextTick vs setImmediateSingle-choice MCQ

In the standard Node.js event loop, the callbacks below are all scheduled from the top-level (main) module. In what order do they print?

const order = []; Promise.resolve().then(() => order.push('promise')); process.nextTick(() => order.push('nextTick')); setImmediate(() => order.push('immediate')); setTimeout(() => { order.push('timeout'); console.log(order.join(',')); }, 0);