Quick JS Brain Teaser: What will be the output of this code? async function test() { console.log('1'); setTimeout(() => { console.log('2'); }, 0); await Promise.resolve(); console.log('3'); setTimeout(() => { console.log('4'); }, 0); console.log('5'); } test(); console.log('6'); A) 1, 6, 3, 5, 2, 4 B) 1, 3, 5, 6, 2, 4 C) 1, 6, 2, 3, 5, 4 D) 1, 2, 3, 4, 5, 6 Drop your answer in the comments and explain why! Does this match your expectations for execution context questions? #JavaScript #JavaScriptInterviewQuestion #JavaScriptFundamentals
A
163524
A option is correct As callback function belongs to macrotask queue and promises belongs to microtask queue Priority: call stack > microtask queue> macrotask queue