Using return in ES6 generator function
<p>I am having trouble finding out what happens if you use a return statement instead of yield.</p>

<pre><code>function *gen(){

 const val = yield someAsyncFn();
 assert.equal(val,4);
 return val;

}
</code></pre>

<p>how does the return behave differently from the yield? I assume the return acts as a normal return statement, but the context of a generator function, does it also call <code>gen.return()</code> as well? Sort of confusing.</p>

<p>Perhaps the above is merely identical to this?</p>

<pre><code>   function *gen(){

     const val = yield someAsyncFn();
     assert.equal(val,4);
     yield val;

   }
</code></pre>