Tech
`async` Is Built on an Idea You Can See in `yield`
async Is Built on an Idea You Can See in yield
yield and await aren't the same thing.
A generator isn't an async function, and an async function isn't a generator.
But there is an idea hiding underneath both of them that is easy to miss:
execution can stop here and continue later.
Once you see that, async/await starts looking a lot less magical.
π΄ The Problem
Consider a generator:
function * work () {
console . log ( " A " );
...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to