title: How do I exit an Array.forEach loop early?
body: <p>I'm working on a homework problem using JavaScript. I have a solution that currently works, but I am sure that it is not the most efficient way to do it. I am iterating over an array to check if <strong><em>any</em></strong> element meets a certain condition. But there doesn't seem to be a way to exit the <code>forEach()</code> function early. In other languages, I have used <code>break</code> to quit a forEach loop early. Does something similar exist in JavaScript?</p>
  
  <p>My code (simplified for this question):</p>
  
  <pre><code>let conditionMet = false;
  
  numbers.forEach((number) =&gt; {
    if (number % 3 === 0) {
      conditionMet = true;
      // break; &lt;-- does not work!
    }
  });
  </code></pre>