JavaScript · Senior · Question 1 of 75

How does the event loop process tasks in the browser?

Explanation

After each macrotask (script, event, timer), the microtask queue is drained completely, including microtasks added along the way. Then the browser may update rendering (calling requestAnimationFrame) if it's time for a frame. That's why a long chain of microtasks also blocks rendering.

Further reading

Problem with a question

JavaScript · Senior · question 1

Test yourself

Take the JavaScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz