title: Why are "continue" statements bad in JavaScript?
body: <p>In the book <em>Javascript: The Good Parts</em> by Douglas Crockford, this is all the author has to say about the continue Statement:</p>
  
  <blockquote>
    <p>The <code>continue</code> statement jumps to the top of the loop. I have never seen a piece of code that was not improved by refactoring it to remove the <code>continue</code> statement. </p>
  </blockquote>
  
  <p>This really confuses me. I know Crockford has some very opinionated views on JavaScript, but this just sounds entirely wrong to me.</p>
  
  <p>First of all, <code>continue</code> does more than just jump to the top of a loop. By default, it also progresses to the next iteration. So isn't Crockford's statement just completely false information?</p>
  
  <p>More importantly, I do not entirely understand why <code>continue</code> would even be considered to be bad. This post provides what seems to be the general assumption:
  <a href="https://stackoverflow.com/questions/4913981/why-is-continue-inside-a-loop-a-bad-idea">Why is continue inside a loop a bad idea?</a></p>
  
  <p>Although I understand how <code>continue</code> may make code difficult to read in certain instances,  I think it is just as likely that it can make code more readable. For instance:</p>
  
  <pre><code>var someArray=['blah',5,'stuff',7];
  for(var i=0;i&lt;someArray.length;i++){
      if(typeof someArray[i]==='number'){
          for(var j=0;j&lt;someArray[i];j++){
              console.log(j);
          }
      }
  }
  </code></pre>
  
  <p>This could be refactored into:</p>
  
  <pre><code>var someArray=['blah',5,'stuff',7];
  for(var i=0;i&lt;someArray.length;i++){
      if(typeof someArray[i]!=='number'){
          continue;
      }
      for(var j=0;j&lt;someArray[i];j++){
          console.log(j);
      }
  }
  </code></pre>
  
  <p><code>continue</code> isn't particularly beneficial in this specific example, but it does demonstrate the fact that it reduces the nesting depth. In more complex code, this could potentially increase readability.</p>
  
  <p>Crockford provides no explanation as to why <code>continue</code> should not be used, so is there some deeper significance behind this opinion that I am missing?</p>