title: Iteration in JavaScript
body: <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript" rel="nofollow">This MDN page</a> claims:</p>
  
  <blockquote>
    <p>...you can iterate over an array using the following:</p>
  
  <pre><code>for (var i = 0; i &lt; a.length; i++) {
    // Do something with a[i]
  }
  </code></pre>
    
    <p>This is slightly inefficient as you are looking up the length property
    once every loop. An improvement is this:</p>
  
  <pre><code>for (var i = 0, len = a.length; i &lt; len; i++) {
    // Do something with a[i]
  }
  </code></pre>
    
    <p>A nicer-looking but limited idiom is:</p>
  
  <pre><code>for (var i = 0, item; item = a[i++];) {
    // Do something with item
  }
  </code></pre>
  </blockquote>
  
  <p>Are these really commonly accepted ways of iteration? Wouldn't modern JavaScript engines simply optimize the first one?</p>