Checks whether an element in a collection passes a test.
Checks whether an element in a collection passes a test.
Checks whether an element in a collection passes a test.
Checks whether an element in a collection passes a test.
Tests whether at least one element in a collection passes a test implemented by a predicate function, iterating from right to left.
The predicate function is provided three arguments:
value
: collection valueindex
: collection indexcollection
: the input collectionThe function immediately returns upon encountering a truthy return value.
If provided an empty collection, the function returns false
.
input collection
test function
execution context
boolean indicating whether at least one element passes a test
function isNegative( v ) {
return ( v < 0 );
}
var arr = [ 1, 2, 3, 4, -1 ];
var bool = anyBy( arr, isNegative );
// returns true
Checks whether an element in a collection passes a test.
collection value
collection index
boolean indicating whether an element in a collection passes a test