async/await vs .then() in JavaScript
async/await and .then() both handle promises, but async/await reads like synchronous code and simplifies error handling with try/catch.
Published September 17, 2026
async/await and .then() both handle promises; await just lets you write asynchronous code that reads top to bottom. They are interchangeable, so choose based on readability.
The concept
A promise represents a value that will arrive later. .then(cb) registers a callback for when it resolves; await pauses the surrounding async function until it resolves and gives you the value.
await does not block the thread; the rest of the program keeps running. Errors become exceptions you can handle with try/catch, instead of .catch() at the end of a chain.
Same logic, two styles
- Start the request (fetch returns a promise)
- Wait for the response — .then(cb) or await
- Parse the JSON body, again with .then or await
- Handle errors: .catch(cb) or try/catch
Practical examples
Promise chain
fetch('/api/user')
.then(r => r.json())
.then(user => console.log(user.name))
.catch(console.error)async/await
async function show() {
try {
const r = await fetch('/api/user')
const user = await r.json()
console.log(user.name)
} catch (e) { console.error(e) }
}Run in parallel, not sequence
Awaiting one after another is slow when the calls are independent.
const [a, b] = await Promise.all([getA(), getB()])Common mistakes
- Using await inside forEach — it does not wait; use for…of or Promise.all with map.
- Awaiting independent calls one by one when they could run in parallel.
- Forgetting that an async function always returns a promise.
Key takeaways
- await is syntax over promises, not a different mechanism.
- Use try/catch with await, .catch with chains.
- Use Promise.all for parallel work.
FAQ
Can I use await at the top level?
Yes in ES modules (Node 14.8+ and modern browsers).
Which is faster?
There is no meaningful performance difference.