What is async/await?

async/await is syntax for working with Promises using a more synchronous-looking style. An async function always returns a Promise. The await keyword pauses execution within that async function until the awaited Promise settles, without blocking the Node.js event loop itself. Errors can commonly be handled using try/catch.

Key Takeaways
  • async functions return Promises.
  • await consumes Promise results.
  • try/catch can handle rejected awaited Promises.
Knowledge Check

What does an async function return?