39 lines
920 B
Plaintext
39 lines
920 B
Plaintext
|
|
||
|
{{alias}}( fcn, predicate[, thisArg] )
|
||
|
Invokes a function until a test condition is true.
|
||
|
|
||
|
The condition is evaluated *after* executing the provided function; thus,
|
||
|
`fcn` *always* executes at least once.
|
||
|
|
||
|
When invoked, both the predicate function and the function to invoke are
|
||
|
provided a single argument:
|
||
|
|
||
|
- `i`: iteration number (starting from zero)
|
||
|
|
||
|
Parameters
|
||
|
----------
|
||
|
fcn: Function
|
||
|
The function to invoke.
|
||
|
|
||
|
predicate: Function
|
||
|
The predicate function which indicates whether to stop invoking a
|
||
|
function.
|
||
|
|
||
|
thisArg: any (optional)
|
||
|
Execution context for the invoked function.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> function predicate( i ) { return ( i >= 5 ); };
|
||
|
> function beep( i ) { console.log( 'boop: %d', i ); };
|
||
|
> {{alias}}( beep, predicate )
|
||
|
boop: 0
|
||
|
boop: 1
|
||
|
boop: 2
|
||
|
boop: 3
|
||
|
boop: 4
|
||
|
|
||
|
See Also
|
||
|
--------
|
||
|
|