re: JavaScript Iterators and Generators: Asynchronous Iterators VIEW POST

FULL DISCUSSION
 

I think we can also write it down in this succinct way. But correct me if I'm wrong

const pagination = {
  async *[Symbol.asyncIterator]() {
    let i = 0;
    while (i < 10) {
      await Promise.resolve(true);
      i++;
      yield i;
    }
  }
};

 
code of conduct - report abuse