Junior From PDF JavaScript JavaScript

What is the difference between microtask and macrotask queue?

Type Example Priority

Microtask Promise.then,

MutationObserver

Higher

Macrotask setTimeout, setInterval Lower

Example:

setTimeout(() => console.log("Macro"), 0);
Promise.resolve().then(() => console.log("Micro"));

// Output: Micro → Macro

More from JavaScript Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details