DEV Community

Discussion on: Daily Challenge #220 - What Dominates Your Array?

le_newtype profile image
Nicholas ―M―

Doing this taught me about Array.prototype.some. I originally wanted to use .forEach, but needed a way to break out of the loop once we found the dominator -- no need to keep processing once the answer has been found, especially if the scenario was an array of something ridiculous, like 15,000 items.