Skip to main content
D
JavaScript
JavaScript Async/Await

JavaScript Async/Await

JavaScript async/await makes promises easier to read and write.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

JavaScript added `async` and `await` to make asynchronous code look exactly like normal, synchronous code. Instead of chaining multiple `.then()` methods together, developers simply tell the code to pause and wait for the promise to finish.

Example

Example
1/* this uses async/await */
2async function getData() {
3  let response = await fetch("data.json");
4  let data = await response.json();
5  console.log(data);
6}

Key Points

  • The `async` keyword turns a function into a promise.
  • The `await` keyword pauses execution until the promise finishes.
  • You can only use `await` inside an `async` function.
  • It provides much cleaner error handling using `try/catch`.

Up Next

Continue your journey with the next topic.

Go to JS DOM