What's the point of these?

Hi guys so my question is that what is the point of iterators like = .find(),.findIndex()… is because when the first element in the provided array satisfies the provided testing function, then the iterator stops iterating through the array , so what happens to all the other possible satisfactions ? wouldn’t it make sense that we had something (or maybe there is one and i’m nowt aware of so please tell me) which continues iterating even after the first element in the provided array satisfies the provided testing function.

There are such built-in iterators. .filter(), for example, could return a new array with every element in the original array that matches some criteria. There’s a ton of built-in iterators like this; check out Mozilla’s web docs (MDN Web Docs) for more.

3 Likes