zwgjkq
Last Updated: February 25, 2016
·
1.327K
· av-ast
C24ce8d41d4134d3d616fbd486162c38

Javascript analogue of Ruby's "any?"

[true, true].every(Boolean)
true

[true, true, false].every(Boolean)
false

[true, true, null].every(Boolean)
false

[true, true, ""].every(Boolean)
false

[].every(Boolean)
true

Say Thanks
Respond

2 Responses
Add your response

2011
E12c872b9ba9909b6645c0e855fcba28

Hey, man, look here http://underscorejs.org/#any
;) Also a good thing, right?

over 1 year ago ·
2120
C24ce8d41d4134d3d616fbd486162c38

Yep. Underscore.js rules!
But this pro tip is just for plain JavaScript.

over 1 year ago ·