title: When using JavaScript's reduce, how do I skip an iteration?
body: <p>I am trying to figure out a way to conditionally break out of an iteration when using JavaScript's <code>reduce</code> function. </p>
  
  <p>Given the following code sums an array of integers and will return the number <code>10</code>: </p>
  
  <pre><code>[0, 1, 2, 3, 4].reduce(function(previousValue, currentValue, currentIndex, array) {
    return previousValue + currentValue;
  });
  </code></pre>
  
  <p>How can I do something like this: </p>
  
  <pre><code>[0, 1, 2, 3, 4].reduce(function(previousValue, currentValue, currentIndex, array) {
    if(currentValue === "WHATEVER") {
      // SKIP or NEXT -- don't include it in the sum
    }
    return previousValue + currentValue;
  });
  </code></pre>