title: Why can't I use Array.forEach on a collection of Javascript elements?
body: <p>I'm building an app with Babel/ES6. I want to disable all form elements for a view-only version of it, so I did this:</p>
  <pre><code>let form = document.getElementById('application-form')
  let elements = form.elements
  </code></pre>
  <p>I expected to be able to do this, instead of using a regular old <code>for</code> loop (which did work):</p>
  <pre><code>elements.forEach((el) =&gt; {
      el.disabled = true
  })
  </code></pre>
  <p>but I got <code>TypeError: elements.forEach is not a function</code></p>
  <p>The strange thing is if I <code>console.log(elements)</code> in the Chrome dev console it exactly like an array with a bunch of <code>input</code> objects. It doesn't display with the <code>Object</code> notation for objects, and all of the keys are integers. I'm thinking it's some sort of pseudo array, but I wouldn't even know how to find that out.</p>
  <p><strong>EDIT</strong>: short answer it's not an array it's an HTMLCollection. see <a href="https://stackoverflow.com/questions/13433799/why-doesnt-nodelist-have-foreach">Why doesn&#39;t nodelist have forEach?</a></p>
  <br>
  <h2>*UPDATE*</h2>
  <p>Per <a href="https://stackoverflow.com/a/27024188/2212678">this answer</a>, <code>nodelist</code> now has the <code>forEach</code> method!</p>