On Feb 13, 7:01 am, Axel Kittenberger <[email protected]> wrote:
> Why they didn't make the standard forEach in that returning false
> terminates the loop is beyond me...

You can just abuse the short-circuiting of [].some:

> [ 1, 2, 3, 4, 5, 6, 7 ].some(function (x) { console.log(x); if (x > 4) return 
> true })
1
2
3
4
5

Instead of `return false`, it's `return true`.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to