Рет қаралды 4,098
Iterators are great for looping through data sets. If you have an array then it has a built-in iterator. Objects can have a custom iterator built for them.
What if your dataset is too big to fit inside your Array? What if it takes up too much memory? With an Asynchronous Iterator you can load the data in chunks.
The for...of loop will have an await capability soon. However, we can already mimic the behaviour by creating an asynchronous function and calling it recursively.
Code GIST: gist.github.co...
IIFE video: • JavaScript IIFE (Immed...