The await operator is used to wait for a Promise returned by an async function.


[rv] = await expression;
A Promise or any value to wait for the resolution.

Returns the resolved value of the promise, or the value itself if it's not a Promise.


The await expression causes async function execution to pause, to wait for the Promise's resolution, and to resume the async function execution when the value is resolved. It then returns the resolved value. If the value is not a Promise, it's converted to a resolved Promise.

If the Promise is rejected, the await expression throws the rejected value.


If a Promise is passed to an await expression, it waits for the Promise's resolution and returns the resolved value.

function resolveAfter2Seconds(x) {
  return new Promise(resolve => {
    setTimeout(() => {
    }, 2000);

async function f1() {
  var x = await resolveAfter2Seconds(10);
  console.log(x); // 10

If the value is not a Promise, it converts the value to a resolved Promise, and waits for it.

async function f2() {
  var y = await 20;
  console.log(y); // 20

If the Promise is rejected, the rejected value is thrown.

async function f3() {
  try {
    var z = await Promise.reject(30);
  } catch(e) {
    console.log(e); // 30


Specification Status Comment
ECMAScript 2017 Draft (ECMA-262)
The definition of 'async functions' in that specification.
Draft Initial definition in ES2017.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Edge Opera Safari (WebKit)
Basic support 55 52.0 (52.0) ? ? 42 10.1
Feature Android Android Webview Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support No support 52.0 (52.0) ? 42 10.1 55

See also

Document Tags and Contributors

 Contributors to this page: nmve, daytonlowell, fscholz, past, arai
 Last updated by: nmve,