An async function always returns a promise. Inside it, await pauses that function until the promise settles — it does not freeze the whole page. This is sugar over .then, not a different system.

Results appear here.

Compare .then chaining with async/await for the same steps.

Important JavaScript

async function loadLabel() {
  const id = await fetchId();
  const player = await fetchPlayer(id);
  return player.name + " (" + player.rating + ")";
}

loadLabel().then(function (label) {
  console.log(label);
});

// await only works inside async functions (or top-level modules).