Guides/How async/await Actually Executes

How async/await Actually Executes

async/await is Promise syntax — the event-loop rules still apply.

Rajan Pandey · About the author

Rajan Pandey is a Full Stack AI Engineer with nearly 3 years of professional experience building production-ready web applications, SaaS platforms, and developer-focused tools. He specializes in JavaScript, TypeScript, React.js, Next.js, Node.js, and the MERN stack.He has worked on 15+ production applications across SaaS, EdTech, and GenAI products, with experience spanning frontend architecture, backend development, REST APIs, database design, authentication, and third-party integrations. StackTools was created as a way to make everyday development tasks simpler and JavaScript concepts easier to understand through interactive, browser- based tools.His goal is to build practical utilities that developers can use without unnecessary complexity, registration, or uploading their data to external servers.

Desugaring mental model

An async function always returns a Promise. Code before the first await runs synchronously when you call it. Each await waits for a thenable, then continues the function body in a later turn — equivalent to chaining .then.

async function load() {
  console.log("start");
  const v = await Promise.resolve(42);
  console.log(v);
  return v;
}
load();
console.log("after call");
// start → after call → 42
Open in Visualizer

Resumption is a microtask

When the awaited Promise fulfills, the continuation is scheduled as a Promise reaction (microtask). That is why await still beats a zero-delay timer scheduled in the same synchronous turn:

async function f() {
  await null;
  console.log("awaited");
}
setTimeout(() => console.log("timeout"), 0);
f();
// awaited → timeout
Open in Visualizer

Rejection and try/catch

Rejected awaits throw into the async function. try/catch around await maps to .catch on the underlying Promise chain. Unhandled rejections still surface if you neither catch nor attach handlers to the returned Promise.

async function boom() {
  try {
    await Promise.reject(new Error("nope"));
  } catch (e) {
    console.log("caught");
  }
}
boom();
Open in Visualizer

When not to await everything

Sequential awaits on independent I/O serialize work. Prefer Promise.all (or allSettled) when requests do not depend on each other. Also avoid awaiting inside tight CPU loops — you pay microtask overhead without I/O benefit.

Try it live

Open the matching StackTools utility — runs in your browser.

Open JS Execution Visualizer