repl.txt (1814B)
1 2 {{alias}}( src[, begin[, end]][, mapFcn[, thisArg]] ) 3 Returns an iterator which iterates over the elements of an array-like 4 object view. 5 6 When invoked, an input function is provided four arguments: 7 8 - value: iterated value 9 - index: iterated value index 10 - n: iteration count (zero-based) 11 - src: source array-like object 12 13 If an environment supports Symbol.iterator, the returned iterator is 14 iterable. 15 16 If an environment supports Symbol.iterator, the function explicitly does not 17 not invoke an array's `@@iterator` method, regardless of whether this method 18 is defined. To convert an array to an implementation defined iterator, 19 invoke this method directly. 20 21 Parameters 22 ---------- 23 src: ArrayLikeObject 24 Array-like object from which to create the iterator. 25 26 begin: integer (optional) 27 Starting index (inclusive). When negative, determined relative to the 28 last element. Default: 0. 29 30 end: integer (optional) 31 Ending index (non-inclusive). When negative, determined relative to the 32 last element. Default: src.length. 33 34 mapFcn: Function (optional) 35 Function to invoke for each iterated value. 36 37 thisArg: any (optional) 38 Execution context. 39 40 Returns 41 ------- 42 iterator: Object 43 Iterator. 44 45 iterator.next(): Function 46 Returns an iterator protocol-compliant object containing the next 47 iterated value (if one exists) and a boolean flag indicating whether the 48 iterator is finished. 49 50 iterator.return( [value] ): Function 51 Finishes an iterator and returns a provided value. 52 53 Examples 54 -------- 55 > var it = {{alias}}( [ 1, 2, 3, 4 ], 1, 3 ); 56 > var v = it.next().value 57 2 58 > v = it.next().value 59 3 60 61 See Also 62 -------- 63