title: JavaScript Generators - How to skip yield when called using .next() ?
body: <p>JavaScript generators allow you to yield actions in a procedural manner. </p>
  
  <p>Is it possible to skip/invoke specific yields natively?</p>
  
  <p>Given the below example, how could this be achieved? </p>
  
  <p>I would like to yield values 1, 3 &amp; 5.</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 *getVal() {
      yield 1;
      yield 2;
      yield 3;
      yield 4;
      yield 5;
  } 
  
  
  let x = getVal();
  
  // I want to yield ONLY values 1 , 3 , &amp; 5
  
  // Here val will equal 1
  let val = x.next();
  
  // I now want to val to equal 3
  val = &lt;&lt; skip second yield and hit 3 &gt;&gt;
  
  // Is it possible to skip a yield natively?
  // ...</code></pre>
  </div>
  </div>
  </p>