Async functions, async / await

suggest change

Introduction

async and await build on top of promises and generators to express asynchronous actions inline. This makes asynchronous or callback code much easier to maintain.

Functions with the async keyword return a Promise, and can be called with that syntax.

Inside an async function, await applies to a promise and resumes the function after that promise settles. A fulfillment becomes the value of the await expression. A rejection throws, so a surrounding try/catch can handle it.

Remarks

Async functions are syntactic sugar over promises. They are more readable, keep error handling in try/catch, and need fewer levels of indentation.

Introduction

Await and operator precedence

Async functions compared to Promises

Looping with async await

Less indentation

Simultaneous async parallel operations

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents