async/await Async/await syntax
Last updated: 2026-09-09
async/await Async/await syntax
async/await is syntactic sugar for Promises, making async code look synchronous.
| Category | Async |
|---|---|
| ES version | ES2017 |
📝 Syntax
async function fn() {
const result = await promise;
}
Returns:An async function returns a Promise.
Mutates the original:No (returns a new value)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
undefined
💡 Tip await only works inside async functions (or top-level in ES2022 modules).
⚠️ Warning Independent awaits should use Promise.all — sequential await is unnecessary serialization.
🌐 Browser support
| Browser | |||||
|---|---|---|---|---|---|
| async/await | ✓ v32 | ✓ v12 | ✓ v27 | ✓ v8 | ✓ v19 |
| Supported by all modern browsers | |||||
🏷️ Related Items
💡 Related Cases
More case studies coming soon — check back later.
📚 Related Tutorials
❓ FAQ
Qawait only in async functions?
AYes (except top-level in ES2022 modules).
QWhat does an async function return?
AAlways a Promise — even if returning a plain value.
QHow to handle errors?
AWrap await in try/catch — same as sync error handling.