repl.txt (964B)
1 2 {{alias}}( collection, fcn[, thisArg] ) 3 Invokes a function for each element in a collection, iterating from right to 4 left. 5 6 When invoked, the input function is provided three arguments: 7 8 - `value`: collection value 9 - `index`: collection index 10 - `collection`: the input collection 11 12 Parameters 13 ---------- 14 collection: Array|TypedArray|Object 15 Input collection over which to iterate. If provided an object, the 16 object must be array-like (excluding strings and functions). 17 18 fcn: Function 19 The function to invoke for each element in a collection. 20 21 thisArg: any (optional) 22 Execution context. 23 24 Returns 25 ------- 26 out: Array|TypedArray|Object 27 Input collection. 28 29 Examples 30 -------- 31 > function logger( v, i ) { console.log( '%s: %d', i, v ); }; 32 > var arr = [ 1, 2, 3, 4 ]; 33 > {{alias}}( arr, logger ) 34 3: 4 35 2: 3 36 1: 2 37 0: 1 38 39 See Also 40 -------- 41