repl.txt (798B)
1 2 {{alias}}( predicate, fcn[, thisArg] ) 3 Invokes a function until a test condition is true. 4 5 When invoked, both the predicate function and the function to invoke are 6 provided a single argument: 7 8 - `i`: iteration number (starting from zero) 9 10 Parameters 11 ---------- 12 predicate: Function 13 The predicate function which indicates whether to stop invoking a 14 function. 15 16 fcn: Function 17 The function to invoke. 18 19 thisArg: any (optional) 20 Execution context for the invoked function. 21 22 Examples 23 -------- 24 > function predicate( i ) { return ( i >= 5 ); }; 25 > function beep( i ) { console.log( 'boop: %d', i ); }; 26 > {{alias}}( predicate, beep ) 27 boop: 0 28 boop: 1 29 boop: 2 30 boop: 3 31 boop: 4 32 33 See Also 34 -------- 35