Promises and async/await in practice
How do Promises and `async`/`await` compare in JavaScript? Walk me through error handling and chaining, then show how you would run work sequentially versus in parallel.
what they're testing: The interviewer is probing whether you can reason about asynchronous control flow, failure propagation, and dependencies between operations.
Promises are the underlying model; async/await is a cleaner way to work with them. An async function always returns a promise, and await pauses only that function until a promise settles. It does not block the main thread. The choice is mostly about control flow and readability, not two different kinds of asynchronous work.
With chaining, each .then() returns a new promise. Return the next promise from the callback so values and failures keep flowing through one flat chain. A final .catch() handles earlier rejections and exceptions thrown in handlers. With await, a rejection is thrown at the await point, so try/catch gives the same error flow in familiar syntax. If the function cannot recover, let it reject or rethrow instead of swallowing the error.
For dependent work, await each step before starting the next. For independent work, call the operations together and use await Promise.all([...]). That is concurrent rather than a promise creating extra threads. Promise.all rejects on the first rejection, but it does not cancel work already running. Use Promise.allSettled() when every outcome matters, including failures.
Why it lands
- Connects `async`/`await` directly to the promise model.
- Explains how values and failures move through both styles.
- Chooses sequential or concurrent execution from data dependencies.
- Calls out `Promise.all` fail-fast behavior without implying cancellation.
Where people slip
- “`async`/`await` replaces promises, so you choose one style or the other.”
- “`await` blocks the main thread until the operation finishes.”
- “Awaiting several independent calls one after another runs them in parallel.”
- “When one input rejects, `Promise.all` cancels the operations that are still running.”
If they push further
Does `await` block the event loop?
No. It suspends the surrounding async function and lets other work continue; execution resumes after the awaited value settles.
When would you use `Promise.allSettled()` instead of `Promise.all()`?
Use it when every result must be inspected even if some operations fail. `Promise.all()` is a better fit when one failure makes the combined result unusable.
What is the common trap with `await` inside `forEach()`?
`forEach()` does not wait for async callbacks. Use `for...of` for sequential work, or map to promises and await `Promise.all()` for concurrent work.
Sources
- MDN: async function ↗developer.mozilla.org
- MDN: Using promises ↗developer.mozilla.org
- MDN: Promise.all() ↗developer.mozilla.org
- MDN: await ↗developer.mozilla.org
- MDN: Promise.allSettled() ↗developer.mozilla.org
- MDN: Array.prototype.forEach() ↗developer.mozilla.org
Now answer it yourself.
Reading a strong answer is easy. Producing one under pressure is the skill the interview tests. Gapmap grades your answer against the same bar an interviewer would.
beta
The interviewer part is in the works.
The diagnostic, personal maps, and AI mock interviews are being finished right now. The notes stay free either way. Leave an email and you'll get the first-cohort invite, plus a month of Pro when it opens.