repl.txt (1289B)
1 2 {{alias}}( obj, fcn[, thisArg] ) 3 Invokes a function for each own enumerable property of an object. 4 5 When invoked, the function is provided three arguments: 6 7 - `value`: object property value 8 - `key`: object property 9 - `obj`: the input object 10 11 To terminate iteration before visiting all properties, the provided function 12 must explicitly return `false`. 13 14 The function determines the list of own enumerable properties *before* 15 invoking the provided function. Hence, any modifications made to the input 16 object *after* calling this function (such as adding and removing 17 properties) will *not* affect the list of visited properties. 18 19 Property iteration order is *not* guaranteed. 20 21 Parameters 22 ---------- 23 obj: Object 24 Input object, including arrays, typed arrays, and other collections. 25 26 fcn: Function 27 The function to invoke for each own enumerable property. 28 29 thisArg: any (optional) 30 Execution context. 31 32 Returns 33 ------- 34 out: Object 35 Input object. 36 37 Examples 38 -------- 39 > function logger( v, k ) { console.log( '%s: %d', k, v ); }; 40 > var obj = { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }; 41 > {{alias}}( obj, logger ) 42 a: 1 43 b: 2 44 c: 3 45 d: 4 46 47 See Also 48 -------- 49