Skip to content
UniCircle
MediumConceptualAsynchronous JavaScript

Promises and async/await

Question JS-ASY-002

What is a Promise, what states can it be in, and how does async/await relate to promises? How would you run three independent requests in parallel?

Show the explanation

Model answer. A Promise represents a value that will be available later. It is pending, then settles once as either fulfilled (with a value) or rejected (with a reason). You react with .then(), .catch() and .finally().

async/await is syntax on top of promises: an async function always returns a promise, and await pauses that function until a promise settles, letting you write asynchronous code that reads top to bottom, with ordinary try/catch.

JavaScript
async function loadDashboard(id) {
  try {
    // parallel: start all three, then wait for all
    const [user, orders, alerts] = await Promise.all([
      getUser(id), getOrders(id), getAlerts(id),
    ]);
    return { user, orders, alerts };
  } catch (err) {
    showError(err);
  }
}

Awaiting each call on its own line would run them one after another, three times slower. Related combinators:

  • Promise.all: rejects as soon as one rejects.
  • Promise.allSettled: waits for all, never rejects.
  • Promise.race: first to settle.
  • Promise.any: first to fulfil.

Original UniCircle question. Last reviewed 22 Oct 2026.