News for hackers. Stuff that matters.
Re:JavaScript and Node performance coding tips to make appli... by sheetjs on Tuesday March 13, 2018 @11:15AM (#16576774)
> It also has no "break" functionality , which is important if we are talking about performance (i.e. when iterating the array to find a specific member).

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:

    [1,2,3,4,5].some(function(n) { console.log(n); return n>=2; });
will not run the callback function after processing the 2

[1] https://news.ycombinator.com/item?id=7938173

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 :)