title: Why is it necessary to iterate through a NodeList if it is already an array?
body: <p>I am working on an assignment that involves using a <code>for</code> loop to iterate through a NodeList of all the button tags on an HTML page using the following code:</p>
  
  <pre><code>var bns = document.getElementsByTagName("button");
  for (var i = 0; i &lt; bns.length; i++) {
    bns[i].addEventListener("click", function() {
      alert("you clicked"); 
    });
  }
  </code></pre>
  
  <p>This code works, however, I am struggling to understand why it is necessary to do this, i.e. to put a NodeList into an array in order to access it. Isn't a NodeList already an array?</p>