Last Updated: September 29, 2021
·
1.538K
· av-ast

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

2 Responses
Add your response

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

over 1 year ago ·

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

over 1 year ago ·