How can I check if all elements of an array are truthy or falsey.
Since the following doesn't seem to do it: _.all([true, true, true], true);
it returns: false
?
You should re-read the _.every(collection, [predicate=_.identity])
api doc of lodash. The issue with your code is the second param you are passing. Remove it and it works
> _.every([true, 'foo', 1])
true
> _.every([true, 'foo', 1, 0])
false
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.