title: Iterating through generator in ES6
body: <p>this code </p>
  
  <pre><code>let func = function *(){
      for (let i = 1; i &lt; 5; i++) {
          yield i;
      }
  }
  let s = func().next();
  console.log(s);
  let s2 = func().next();
  console.log(s2);
  </code></pre>
  
  <p>returns </p>
  
  <pre><code>Object {value: 1, done: false}
  Object {value: 1, done: false}
  </code></pre>
  
  <p>so basically func yields first value all the time.</p>
  
  <p>But when I change to </p>
  
  <pre><code>let f = func();
  let s = f.next();
  console.log(s);
  let s2 = f.next();
  console.log(s2);
  </code></pre>
  
  <p>it works as expected.
  Why assigning func to variable makes such a difference?</p>