title: JavaScript - Nuances of myArray.forEach vs for loop
body: <p>I've seen plenty of questions that suggest using:</p>
  
  <pre><code>for (var i = 0; i &lt; myArray.length; i++){ /* ... */ }
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>for (var i in myArray){ /* ... */ }
  </code></pre>
  
  <p>for arrays, due to inconsistent iteration (<a href="https://stackoverflow.com/questions/242841/javascript-for-in-vs-for">see here</a>).</p>
  
  <hr>
  
  <p>However, I can't seem to find anything that seems to prefer the object oriented loop:</p>
  
  <pre><code>myArray.forEach(function(item, index){ /* ... */ });
  </code></pre>
  
  <p>Which seems way more intuitive to me.</p>
  
  <p>For my current project, IE8 compatibilty is important, and I'm considering using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Polyfill" rel="noreferrer">Mozilla's polyfill</a>, however I'm not 100% sure how this will work.</p>
  
  <ul>
  <li>Are there any differences between the standard for loop (the first example above) and the Array.prototype.forEach implementation by modern browsers?</li>
  <li>Are there any difference between modern browser implementations and Mozilla's implementation linked to above (with special regard to IE8)?</li>
  <li>Performance is not as much of an issue, just consistency with which properties are iterated over.</li>
  </ul>