There are some key differences. One of the biggest differences is that after finishing the await call inside an async function, the function does not terminate nor return a value. Instead, it continues its execution normally. With generators however, you can pause and return values on demand using the yield keyword.
But if you actually think about it, they have so much in common. Actually, it is easy to replicate the behavior of async/await using generators. This article describes a brief idea on how to do this with little effort.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
isn't this pretty similar to async/await?
There are some key differences. One of the biggest differences is that after finishing the
await
call inside anasync
function, the function does not terminate nor return a value. Instead, it continues its execution normally. With generators however, you can pause and return values on demand using theyield
keyword.But if you actually think about it, they have so much in common. Actually, it is easy to replicate the behavior of
async/await
using generators. This article describes a brief idea on how to do this with little effort.