title: how to stop Javascript forEach?
body: <p>I'm playing with Node.js and Mongoose — trying to find specific comment in deep comments nesting with recursive function and <code>forEach</code> within. Is there a way to stop Node.js <code>forEach</code>? As I understand every <code>forEach</code> iteration is a function and and I can't just do <code>break</code>, only <code>return</code> but this won't stop <code>forEach</code>.</p>
  <pre class="lang-js prettyprint-override"><code>function recurs(comment) {
      comment.comments.forEach(function(elem) {
  
          recurs(elem);
  
          //if(...) break;
  
      });
  }
  </code></pre>