Awesome work getting the hang of the
async...await syntax! Let’s review what you’ve learned:
- We declare an async function with the keyword
- Inside an
asyncfunction we use the
awaitoperator to pause execution of our function until an asynchronous action completes and the awaited promise is no longer pending .
awaitreturns the resolved value of the awaited promise.
- We can write multiple
awaitstatements to produce code that reads like synchronous code.
- We use
try...catchstatements within our
asyncfunctions for error handling.
- We should still take advantage of concurrency by writing
asyncfunctions that allow asynchronous actions to happen in concurrently whenever possible.