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