DEV Community

Discussion on: Asynchronous Javascript: 3 ways

Collapse
 
dezfowler profile image
Derek Fowler • Edited

await isn't blocking, it creates a continuation from all the code within the async function that appears after the await statement. That continuation runs when the thing being awaited resolves.

An async function implicitly returns a promise when it hits the first await statement and control is returned to the calling code which will continue to run.

If there was a return value from myFunction, that is also wrapped in a promise and you'd need to use an await or a .then() to use it.