re: Daily Challenge #220 - What Dominates Your Array? VIEW POST


Here's my solution in JavaScript. I'm not sure how to embed Gists, but here is the link to it .... 😥



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.

code of conduct - report abuse