repl.txt (1801B)
1 2 {{alias}}( src[, options][, mapFcn[, thisArg]] ) 3 Returns an iterator which repeatedly iterates over the elements of an array- 4 like object. 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 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 options: Object (optional) 27 Function options. 28 29 options.iter: integer (optional) 30 Number of iterations. Default: 1e308. 31 32 options.dir: integer (optional) 33 Iteration direction. If set to `-1`, an iterator iterates over elements 34 from right-to-left. Default: 1. 35 36 mapFcn: Function (optional) 37 Function to invoke for each iterated value. 38 39 thisArg: any (optional) 40 Execution context. 41 42 Returns 43 ------- 44 iterator: Object 45 Iterator. 46 47 iterator.next(): Function 48 Returns an iterator protocol-compliant object containing the next 49 iterated value (if one exists) and a boolean flag indicating whether the 50 iterator is finished. 51 52 iterator.return( [value] ): Function 53 Finishes an iterator and returns a provided value. 54 55 Examples 56 -------- 57 > var it = {{alias}}( [ 1, 2, 3, 4 ] ); 58 > var v = it.next().value 59 1 60 > v = it.next().value 61 2 62 63 See Also 64 -------- 65