title: How to stop javascript filter function from iteration
body: <p>my code is as follow</p>
  <pre><code>            sortedProducts = sortedProducts.filter((product, i) =&gt; {
                    if (i + 1 &gt; limit) {
                        return false;
                    }
                    return product.name.startsWith(search);
              });
  </code></pre>
  <p>i want to stop iterating at the <code>index = limit</code>
  so i can optimize my function because there is no need for items with <code>index &gt; limit</code>
  is there something similar to the word <code>break</code> in this case ?
  Thanks in advance</p>