ES6 Async/Await

Learn ES6 Async/Await

Learn how to implement and handle asynchronous methods in JavaScript using ES6 syntax.

🕓 Last updated today

Knowledge Check

Take this customized & interactive quiz to test your knowledge on ES6 Async/Await, then check out the learning resources below.

Question 1 of 7

Given the following promise:

const promise = new Promise((resolve, reject) => {
  setTimeout(() => {
    resolve('Hello World!');
    reject(new Error('error'));
  }, 2000);
});

Which one of the following code blocks correctly rewrites this promise code using ES6 async/await?

function main() {
  promise
    .then((result) => console.log(result))
    .catch((error) => console.error(error));
}



Core Learning

The fastest way to learn ES6 Async/Await is simply to study these exact resources. Focus on the 👀 to learn extra quickly and save time!

Concept: What is a promise?

👀 1 Thing to Focus On

  • Async/Await is just a way to describe Promises in ES6 syntax. You should first understand what Promises are.

How to: Write an async method

👀 1 Thing to Focus On

  • Understand how to read and implement async functions.

How to: Handle Errors
Gotchas: Parallelism

👀 1 Thing to Focus On

  • Not all asynchronous logic can be implemented with async/await syntax.