title: forEach callback does not execute with getElementsByClassName
body: <p>In the below code,</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Hide odd rows&lt;/title&gt;
          &lt;meta charset="UTF-8"&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div style="background-color:#8F9779;width:200px;height:30px;"&gt;
          &lt;/div&gt;
          &lt;hr style="width:200px" align="left"&gt;
          &lt;table border="1" &gt;
              &lt;tr class="hide" &gt;
                  &lt;td width="40" height="20"&gt;row 1&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td width="40" height="20"&gt;row 2&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr class="hide"&gt;
                  &lt;td width="40" height="20"&gt;row 3&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td width="40" height="20"&gt;row 4&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr class="hide"&gt;
                  &lt;td width="40" height="20"&gt;row 5&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;&lt;br&gt;
          &lt;button type="button" name="HideRows"&gt;Hide Odd Rows&lt;/button&gt;
          &lt;script type="text/javascript" src="hideOddRows.js"&gt;&lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>/* hideOddRows.js */
  document.querySelector('[name=HideRows]').onclick = hideRows;
  
  function hideRows(){
      var elements = document.getElementsByClassName('hide');
      elements.forEach(function(element){
          element.style.visibility = "hidden";
      });
      return true;
  }
  </code></pre>
  
  <hr>
  
  <p>As per debugging, callback function for each <code>element</code> of <code>elements</code> array is not executing on click event.</p>
  
  <p>I consider <code>elements</code> as keyed collection, as shown below..</p>
  
  <p><a href="https://i.stack.imgur.com/yCgIL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yCgIL.png" alt="enter image description here"></a></p>
  
  <p>--</p>
  
  <p>How to resolve this error?</p>