How does the event loop work in JavaScript?
What they're checking
Whether you understand how asynchronous code actually runs, not just how to write it.
A strong answer covers
- Explain that JavaScript runs one call stack, and that async work is handed off and queued for later.
- Separate the queues, tasks such as setTimeout callbacks and microtasks such as promise callbacks.
- Say that all pending microtasks run before the next task, so a resolved promise beats a setTimeout of zero.
- Tie it to a real consequence, such as a long loop freezing the page because the stack never empties.