Favorites

JavaScript await Operator

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
await
JavaScript Unary OperatorThis operator is supported by all modern browsers.
Updated 28th November 2026

The await operator pauses an async function until a promise settles, then gives back its result, or throws if the promise rejects.

Description

The await operator is used inside async functions (and at the top level of modules) to wait for a promise. It pauses the function until the promise settles, then evaluates to the fulfilled value; if the promise rejects, await throws the reason, which you can catch with try...catch. Non-promise values are returned as they are.

Pausing only affects the async function itself; the rest of the page keeps running. To run independent tasks in parallel, start them together and await Promise.all([...]), rather than awaiting each one in turn.

Errors in awaited promises can also be handled by attaching .catch() before awaiting, as in await load().catch(() => fallback), which keeps short operations on one line. Inside loops, await runs each iteration one after another, which is right when order matters; use Promise.all() with map() when iterations are independent.

Properties

Operator
await
Category
Unary
Precedence
14 (1 is lowest, 18 is highest)
Associativity
right-to-left

Syntax

await expression

Example

const wait = (ms, v) => new Promise(r => setTimeout(() => r(v), ms));

async function main() {
  console.log('start');
  const a = await wait(200, 'first');
  console.log(a);
  const [b, c] = await Promise.all([wait(100, 'b'), wait(100, 'c')]);
  console.log(b, c);
  try { await Promise.reject(new Error('boom')); }
  catch (e) { console.log('caught', e.message); }
}
main();
console.log('main() is running in the background');

Browser Support

The following information will show you the current browser support for the await operator. Hover over a browser icon to see the version that first introduced support for this operator.

This operator is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee