What is the difference between microtasks and macrotasks?

Senior JavaScript

Answer

Microtasks: Executed immediately after current execution stack (Promises, queueMicrotask).

Macrotasks: Executed in next event loop turn (setTimeout, setInterval, I/O).

Crucial for understanding async flow and ordering.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice