Back to JavaScript

JavaScript Tutorial

Promises and Async/Await

Write cleaner asynchronous code with promises and async functions.

Promises represent work that may finish later.

Async and await make promise-based code easier to read.

javascript
async function loadUsers() {
  const response = await fetch("/api/users");
  const users = await response.json();
  return users;
}