Checks whether an element in a collection passes a test.
Function invoked for each collection element until test condition is true.
Function invoked for each collection element until test condition is true.
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 until test condition is true.
Checks whether an element in a collection passes a test.
Function invoked for each collection element until test condition is true.
Checks whether an element in a collection passes a test.
Until a test condition is true, invokes a function once for each element in a collection, iterating from right to left.
For dynamic array resizing, the only behavior made intentionally consistent with untilEach
(iterating from left to right) is when elements are pushed onto the beginning (end) of an array. In other words, for untilEach()
, [].push()
behavior is consistent with untilEachRight()
[].unshift()
behavior.
When invoked, both the predicate function and the function to apply are provided three arguments:
value
: collection valueindex
: collection indexcollection
: the input collectioninput collection
function which indicates whether to stop 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 ];
untilEachRight( arr, predicate, log );
Function invoked for each collection element until test condition is true.
collection value
collection index