title: Can I pass two functions in array.foreach
body: <p>I read a perfectly running code recently in which two functions are passed in array.foreach for a mongo cursor. I would like to know the proper working of this code.</p>
  
  <pre><code>    var myArray = [];
      mongoCursor.forEach(function(element) {
        myArray.push(element);
      }, () =&gt; {
        console.log(myArray.length);
      });
  </code></pre>