Checks whether an element in a collection passes a test.
Function invoked for each collection element passing a test.
Function invoked for each collection element passing a test.
Checks whether an element in a collection passes a test.
Checks whether an element in a collection passes a test.
Function invoked for each collection element passing a test.
Checks whether an element in a collection passes a test.
Function invoked for each collection element passing a test.
Checks whether an element in a collection passes a test.
While a test condition is true, invokes a function once for each element in a collection, iterating from right to left.
When invoked, both the predicate function and the function to apply are provided three arguments:
value
: collection valueindex
: collection indexcollection
: the input collectionFor dynamic array resizing, the only behavior made intentionally consistent with whileEach
(iterating from left to right) is when elements are pushed onto the beginning (end) of an array. In other words, for whileEach()
, [].push()
behavior is consistent with whileEachRight()
[].unshift()
behavior.
input collection
function which indicates whether to continue iterating over a collection
function to invoke
execution context for the applied function
input collection
function predicate( v, index, collection ) {
return ( v === v );
}
function log( v, index, collection ) {
console.log( '%s: %d', index, v );
}
var arr = [ 1, NaN, 2, 3, 4, 5 ];
whileEachRight( arr, predicate, log );
Function invoked for each collection element passing a test.
collection value
collection index