Re:JavaScript and Node performance coding tips to make appli...
by gbuk2013 on Tuesday March 13, 2018 @11:41AM
(#16577030)
"some" !== "forEach" ;)
Also, "some" still has the performance penalty of an extra function call per iteration (as I know you know based on your linked comment) and we are talking about performance advice here.
But good point - I've never actually used "some" before, so I learn something new today - thanks :)
The article is woefully misinformed regarding `forEach` and I agree that the array methods in general are slower [1], but `some` will bail out on the first true value returned. To be sure:
will not run the callback function after processing the 2[1] https://news.ycombinator.com/item?id=7938173