Question 4 of 10Pro Only

Explain the difference between microtasks and macrotasks in the JavaScript Event Loop. In what order do they execute?

Sample answer preview

The Event Loop manages asynchronous code execution in JavaScript. It uses two types of queues with different priorities: microtasks and macrotasks. Macrotasks, also called tasks, include setTimeout, setInterval, setImmediate in Node.js, DOM events, and requestAnimationFrame…

event loopmicrotaskmacrotaskPromisesetTimeoutqueueMicrotask

Unlock the full answer

Get the complete model answer, key points, common pitfalls, and access to 9+ more Frontend Developer interview questions.

Upgrade to Pro

Starting at $19/month • Cancel anytime