- Will return a promise that resolves when the function is complete
An async/await function has a basic structure like this:
This function will do the following:
- It will immediately run, but pause and wait at the
awaitline while the promise resolves
- Once the promise resolves, it will continue until the function completes or there’s another
- When the function is assigned to
asyncValue, the variable’s value will be an unresolved promise.
- When the variable’s promise resolves, you can treat it like any other resolved promise. In this case, it uses
.thento take the returned value when completed and log it.