title: How to use generator.next() inside while loop?
body: <p>I have generator</p>
  
  <pre><code>function* pendingPage() {
      let value = 1;
      while (true)
          yield getPage(value++);
  }
  </code></pre>
  
  <p>I have <code>getPage()</code> function </p>
  
  <pre><code>async function getPage(value) {
      const page = await service.getValidations(value);
      (page.data.customers.length === 0) ? service.isCustomersFinished = false : console.log(page.data.customers);
  }
  </code></pre>
  
  <p>I have while infinite loop with the following syntax:</p>
  
  <pre><code>let generator = pendingPage()
  while(true){
     generator.next();
  }
  </code></pre>
  
  <p>And I want to use <code>generator.next()</code> function inside it. But the generator does not work.</p>
  
  <p>I tried with the <code>for</code> loop, and it works fine.</p>
  
  <p>So, what is the problem with it and how to use <code>generator.next()</code> inside infinite while loop?</p>