async/await always returns promise
Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question. Provide details and share…
Above is a great link with info. Some things I want to summarize:
- The async keyword in front of a function RETURNS another function. That returned function is an asyncFunction Object, which is simply another type of function. It is as if you are passing that function as an argument to ‘async.’ That returned async function, when later called, will then return a Promise.
- Await is written in front of Promises to wait for them to resolve before continuing executing code.
- When await is written in front of an async function call (remember, they return Promises), it means that we will wait for the Promise to resolve.
- The await inside an async function is what will keep the returned Promise from resolving, until the awaited Promise is first resolved. So it is a Promise inside a Promise.