Intermediate JavaScript
Q41 / 100

What is the difference between microtasks and macrotasks?

Correct! Well done.

Incorrect.

The correct answer is B) Microtasks (Promise callbacks, queueMicrotask) run before the next macrotask (setTimeout, setInterval, I/O callbacks)

B

Correct Answer

Microtasks (Promise callbacks, queueMicrotask) run before the next macrotask (setTimeout, setInterval, I/O callbacks)

Explanation

After each macrotask, the entire microtask queue drains before the next macrotask runs. This means Promise .then() callbacks run before setTimeout callbacks.

Progress
41/100