Async/Await
Async/Await
Section titled “Async/Await”Introduction
Section titled “Introduction”async/await is syntactic sugar over Promises. It lets you write asynchronous code that reads like synchronous code.
Topics Covered
Section titled “Topics Covered”- Async Functions — Declaring async functions
- Await Keyword — Pausing execution for promises
- Error Handling — try/catch with async/await
- Parallel Execution — Using Promise.all with async/await
- Top-Level Await — Using await outside async functions
Summary
Section titled “Summary”asyncmakes a function return a Promiseawaitpauses until the Promise resolves- Error handling uses
try/catch - Use
Promise.all()for parallel operations