any (callback, target) Booleanpublic
Returns true if the passed function returns true for any item in the enumeration. This corresponds with the some() method in JavaScript 1.6.
The callback method you provide should have the following signature (all parameters are optional):
function(item, index, enumerable);
-
itemis the current item in the iteration. -
indexis the current index in the iteration. -
enumerableis the enumerable object itself.
It should return the true to include the item in the results, false otherwise.
Note that in addition to a callback, you can also pass an optional target object that will be set as this on the context. This is a good way to give your iterator function access to the current object.
Usage Example:
if (people.any(isManager)) {
Paychecks.addBiggerBonus();
}
Parameters:
-
callback
Function - The callback to execute
-
target
[Object] - The target object to use
Returns:
-
Boolean - `true` if the passed function returns `true` for any item
Please login to continue.