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