In the previous recipe, we saw how to use async to create functions that resolve promises. However, we used the Promise API then callback to wait for the result. In many situations, we can use the await key word to wait for these values. It gets the job done, but there is a cleaner way to retrieve results from asynchronous functions.
This recipe demonstrates how to use await in order to return the result of a long-running operation.