Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardNodeJSevent loop phasesSingle-choice MCQ

When setTimeout(fn, 0) and setImmediate(fn) are both scheduled at the top level of the main module, their relative order is NOT deterministic across runs. What is the underlying reason?

setTimeout(() => console.log('timeout'), 0); setImmediate(() => console.log('immediate'));