Below is an excerpt from my free e-book Async JavaScript. You can read the full book on https://asyncjsbook.com
Generators are special functio...
For further actions, you may consider blocking this person and/or reporting abuse
Great article AJ, you can also use
for-await-of
but it works for async iterables, you can also use them with an array of promises.Here's how you would create an async iterable.
The best part about this approach is concurrency, the async generator
asyncGen
only creates a new promise when asked for, and thefor-await-of
automatically awaits at the start of for loop, resolves it and puts it as the constg
.Thanks for your comment Kushan!