title: Using forEach on an array from getElementsByClassName results in “TypeError: undefined is not a function”
body: <p>In <a href="http://jsfiddle.net/jer2/zcrh9/3/">my JSFiddle</a>, I’m simply trying to iterate over an array of elements. The array is non-empty, as the log statements prove. Yet the call to <code>forEach</code> gives me the (not so helpful) “Uncaught <code>TypeError</code>: <code>undefined</code> is not a function” error.</p>
  
  <p>I must be doing something stupid; what am I doing wrong?</p>
  
  <p>My code:</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>var arr = document.getElementsByClassName('myClass');
  console.log(arr);
  console.log(arr[0]);
  arr.forEach(function(v, i, a) {
    console.log(v);
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.myClass {
    background-color: #FF0000;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="myClass"&gt;Hello&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>