title: Foreach function that clicks on check boxes
body: <p>I need function to click on a range of check boxes. I do however not always know what i is. I tried a write a forEach loop, but it does not work:</p>
  
  <p>This for loop works:</p>
  
  <pre class="lang-js prettyprint-override"><code>function check Boxes() {
    for (let i = 0; i &lt; 249; i++) {
      document.getElementsByClassName("inventoryCbox")[i].click();
  
    }
  }
  </code></pre>
  
  <p>and this is the non-working for loop. I think that maybe my syntax is wrong.</p>
  
  <pre class="lang-js prettyprint-override"><code>checkBoxes();
  var boxes = document.getElementsByClassName("inventoryCbox");
  
  function checkBoxes(node) {
    node.forEach(function(boxes) {
      boxes.click()
    });
  }
  </code></pre>