title: Does it ever make sense to include a value in the first next call to generator iterator?
body: <p>As the question states, does it ever make sense to pass a value to the first <code>iterator.next()</code> call or will it always be ignored? As an example:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function* foo(x) {
    var y = 2 * (yield(x + 1));
    var z = yield(y / 3);
    return (x + y + z);
  }
  
  var it = foo(5);
  
  // note: not sending anything into `next()` here
  console.log(it.next()); // { value:6, done:false }
  console.log(it.next(12)); // { value:8, done:false }
  console.log(it.next(13)); // { value:42, done:true }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Notice there is not a value being passed to the first <code>next()</code>. However, in the article I'm trying to learn from, it goes on to say:</p>
  
  <blockquote>
    <p>But if we did pass in a value to that first next(..) call, nothing bad would happen. It would just be a tossed-away value</p>
  </blockquote>
  
  <p>Okay. That makes sense. But now I'm curious to know if there is a use case (or if it's even possible to utilize) where passing in a value has a benefit.</p>
  
  <p><strong>Article: <a href="https://davidwalsh.name/es6-generators" rel="nofollow noreferrer">https://davidwalsh.name/es6-generators</a></strong></p>