.some
and .every
allow a logical connective of Array values.
While .some
combines the return values with OR
, .every
combines them with AND
.
Examples for .some
[false, false].some(function(value) {
return value;
});
// Result: false
[false, true].some(function(value) {
return value;
});
// Result: true
[true, true].some(function(value) {
return value;
});
// Result: true
And examples for .every
[false, false].every(function(value) {
return value;
});
// Result: false
[false, true].every(function(value) {
return value;
});
// Result: false
[true, true].every(function(value) {
return value;
});
// Result: true