Quiz Entry - updated: 2026.06.20
What does the await keyword do and where can it be used?
The await keyword pauses an async function until a Promise resolves, then yields its resolved value.
Can only be used inside async functions. Makes asynchronous code read like synchronous code by avoiding .then() chains.
async function fetchUser() {
const response = await fetch('/api/user');
const data = await response.text();
return data;
}