Event Loop JavaScript Interview Questions
7 curated event loop interview questions for JavaScript — with short answers, detailed explanations, and interview tips. Ideal for Fresh through Tech Lead prep.
What is the JavaScript event loop?
What is the difference between microtasks and macrotasks?
Predict the output order: ```js console.log('A'); setTimeout(() => console.log('B'), 0); Promise.resolve().then(() => { console.log('C'); setTimeout(() => console.log('D'), 0); }); console.log('E'); ```
How does browser rendering relate to the event loop?
How can promise microtasks starve the event loop, and how do you fix it?
How does Node.js's event loop model differ from the browser's?
As a lead, how would you set a scheduling strategy for expensive client-side work (hydration, search indexing, analytics) without harming INP?