The handler runs synchronously until it hits await, then it hands control back to the browser and schedules the rest of the function as a microtask. Once the awaited promise settles, that continuation goes on the microtask queue, which drains completely after the current task and before the next timer or paint. So await never blocks the main thread; it splits the function in two.
Why interviewers ask this
Async is where a lot of developers have a fuzzy mental model. The interviewer wants to know whether you understand that JavaScript is single threaded and cooperative rather than magically parallel, because that understanding is what stops you writing a handler that starves rendering or a loop firing two hundred sequential requests. It also predicts how well you will reason about race conditions, cancellation and stale state later on.
How to structure your answer
- State that JavaScript runs one call stack at a time.
- Describe how await suspends the function and returns the thread.
- Separate the microtask queue from the task queue.
- Finish with one practical consequence, such as awaiting inside a loop.
Example answer
Sure. The handler starts on the main thread like any other function, and everything up to the first await runs synchronously. At the await, the function suspends and returns a promise to its caller, so the browser gets the thread back and can paint. When the awaited promise resolves, the remainder of the function is pushed onto the microtask queue, not the task queue. That matters because microtasks drain fully before the browser takes the next timer or the next frame, so a long chain of promise resolutions can still block rendering even though nothing is technically synchronous. The practical version of this bit me on a dashboard I worked on. We were awaiting inside a for loop over about 300 rows, so every request waited for the one before it and the page took 12 seconds to fill. Switching to Promise.all with a small concurrency limit dropped it under a second. Same code, same thread, completely different behavior.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- Where do requestAnimationFrame callbacks fit relative to microtasks?
- How would you cancel that in flight work if the component unmounts?
- What happens if one of those awaited promises rejects and nothing catches it?
Related full stack developer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions