async function getUser(id) {
const user = fetch(`/api/users/${id}`)
.then(r => r.json());
console.log(user);
return user;
}async function getUser(id) {
const user = await fetch(`/api/users/${id}`)
.then(r => r.json());
console.log(user);
return user;
}Bug: fetch() returns a Promise. Without await, user is a Promise object, not the resolved data.
Explanation: Without await, user holds the Promise itself. Adding await pauses execution until the Promise resolves and gives you the actual data.
Key Insight: Always await async operations inside async functions. A missing await is one of the most common async bugs.