Async/await is a way to handle operations that take time — like fetching data from an API, reading a file, or querying a database — without freezing your application while waiting. It lets your code say 'wait for this to finish, then continue' in a readable way.
Async/await appears in virtually every AI-generated file that touches data. Understanding it helps you read the most common pattern in modern web development.
Some operations aren't instant:
Without async, your app would freeze while waiting. With async, it handles these gracefully.
// Without async — code freezes while waiting
const user = fetchUser(1) // user is a Promise, not actual data
// With async/await — code waits properly
const user = await fetchUser(1) // user is the actual data
The await keyword means "pause here until this finishes."
They always appear together — await can only be used inside an async function.
When you see async and await in AI code:
try/catch blocks around awaitsasync function loadDashboard() {
const user = await fetchUser()
const stats = await fetchStats(user.id)
return { user, stats }
}
This reads almost like English: "Fetch the user, then fetch their stats, then return both."