Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaScripttop-level await orderingSingle-choice MCQ

entry.mjs imports dep.mjs, which contains a top-level await on a timer (a macrotask). Relative to dep's completion, when does entry's own body execute?

// dep.mjs console.log('dep before'); await new Promise(r => setTimeout(r, 0)); console.log('dep after'); // entry.mjs import './dep.mjs'; console.log('entry body');