Created
December 2, 2017 14:08
-
-
Save jialinhuang00/e42723e02776201265e9e2cb78de3f3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = ['a', 'b', 'c', 'd', 'e']; | |
var eArr = arr.entries(); | |
console.log(eArr.next()); // { value: [ 0, 'a' ], done: false } | |
console.log(eArr.next().value); // [1, 'b'] | |
// 剩下c,d,e還沒跑出來,所以... | |
for (let e of eArr) { | |
console.log(e); | |
} | |
// [ 2, 'c' ] | |
// [ 3, 'd' ] | |
// [ 4, 'e' ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment