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
Written by Alexey Astafyev
Related protips
2 Responses

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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#