🚀 JavaScript Interview Question (Event Loop + Async/Await) What will be the output of this code? 🤔 async function foo() { console.log('A'); setTimeout(() => console.log('B'), 0); await Promise.resolve(); console.log('C'); } foo(); console.log('D'); 🧠 Think carefully before answering. This question tests your understanding of: ✅ Call Stack ✅ Microtask Queue ✅ Macrotask Queue ✅ async/await behavior ✅ Event Loop 👇 Drop your answer in the comments (in order). No cheating. No running the code 😄 I’ll share the explanation in the next post. #JavaScript #FrontendDevelopment #ReactJS #WebDevelopment #AsyncAwait #EventLoop #CodingInterview #SoftwareEngineering
A D C B catch here is await 😇
Can you why D not C after A?
A D C B..bcz promises have higher priority then settimeout in async operation
Yeah got it
A D C B