How does Generator.next() processes its parameter?
<p>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/next" rel="noreferrer">documentation</a> says that "You can also provide a parameter to the next method to send a value to the generator." Where does it sends it to?</p>

<p>For example, take these 3 generators:</p>

<pre><code>function* one() {
  while(true) {
    var value = yield null;
  }
}
var g1 = one();  g1.next();
g1.next(1000); //yields null

function* two() {
  var i = 0;
  while (true) {
    i += yield i;
  }
}
var g2 = two(); g2.next(); 
g2.next(1000) // yields 1000

function* three(){
  var index = 0;
  while (true)
    yield index++;
}

 g3 = three();
 g3.next();
 g3.next(1000); // yields 1
</code></pre>

<p>In generators 3 and 1, the argument passed has no effect on <code>next</code>. Why is that? How does generator 2 calculates its return value? Why it is affected by the given argument?</p>