Browser & Web Performance · Middle · Question 12 of 75
What is the advantage of scheduler.yield() over setTimeout(resolve, 0) for yielding?
- 1It runs the continuation on a worker thread
- ✓Correct answer: The continuation goes to the front of the task queue instead of the back, so other queued work doesn't jump ahead
- 3It blocks input until the work is done
Explanation
Both let the browser handle input and render, but with setTimeout your remaining work waits behind any other tasks.