번역이 완료되지 않았습니다. Please help translate this article from English

await연산자는 Promise를 기다리기 위해 사용됩니다. 연산자는 async function 내부에서만 사용할 수 있습니다.


[rv] = await expression;
Promise 혹은 기다릴 어떤 값입니다.

Promise에 의해 만족되는 값이 반환됩니다. Promise가 아닌 경우에는 그 값 자체가 반환됩니다.


await 문은 Promise가 fulfill되거나 reject 될 때까지 async 함수의 실행을 일시 정지하고, Promise가 fulfill되면 async 함수를 일시 정지한 부분부터 실행합니다. 이때  await 문의 반환값은 Promise 에서 fulfill된 값이 됩니다.

만약 Promisereject되면, await 문은 reject된 값을 throw합니다.

await 연산자 다음에 나오는 문의 값이 Promise가 아니면 해당 값을 resolved Promise로 변환시킵니다.

An await can split execution flow, allowing the caller of the await's function to resume execution before the deferred continuation of the await's function. After the await defers the continuation of its function, if this is the first await executed by the function, immediate execution also continues by returning to the function's caller a pending Promise for the completion of the await's function and resuming execution of that caller.


만약 Promiseawait에 넘겨지면, awaitPromise가 fulfill되기를 기다렸다가, 해당 값을 리턴합니다.

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

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


Thenable objects will be fulfilled just the same.

async function f2() {
  const thenable = {
    then: function(resolve, _reject) {
  console.log(await thenable); // resolved!


만약 값이 Promise가 아니라면, 해당 값은 resolvePromise로 변환되며 이를 기다립니다.

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

만약 Promisereject되면, reject된 값이 throw됩니다.

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

try블럭 없이 rejected Promise다루기

var response = await promisedFunction().catch((err) => { console.error(err); });
// response will be undefined if the promise is rejected


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

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
awaitChrome Full support 55Edge Full support 14Firefox Full support 52IE No support NoOpera Full support 42Safari Full support 10.1WebView Android Full support 55Chrome Android Full support 55Firefox Android Full support 52Opera Android Full support 42Safari iOS Full support 10.3Samsung Internet Android Full support 6.0nodejs Full support 7.6.0
Full support 7.6.0
Full support 7.0.0
Disabled From version 7.0.0: this feature is behind the --harmony runtime flag.


Full support  
Full support
No support  
No support
User must explicitly enable this feature.
User must explicitly enable this feature.

See also