Explain Promises, async/await, and how you handle errors and run work in parallel.
A Promise represents a value that is not ready yet. It is pending, then settles once as either fulfilled or rejected, and never changes again.
async/await is syntax over the same objects. An async function always returns a promise, and await pauses that function until the promise settles without blocking the thread.
Error handling: wrap the await in try/catch. The trap is that an async function's rejection does not propagate to the caller unless the caller awaits it too — a forgotten await produces an unhandled rejection that is easy to miss.
Running work in parallel is the point most candidates get wrong. This is sequential and takes as long as both requests combined:
const a = await getA();
const b = await getB();This starts both immediately:
const [a, b] = await Promise.all([getA(), getB()]);The combinators: Promise.all rejects as soon as any input rejects; Promise.allSettled always waits for all of them and reports each outcome; Promise.race settles with the first to settle, useful for timeouts; Promise.any resolves with the first to succeed.





