Created
January 12, 2017 23:26
-
-
Save woliveiras/bb2737620b5bf22dc9db0a8a0b7a0a36 to your computer and use it in GitHub Desktop.
This file contains 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
function* generatorWithEnd() { | |
yield 1; | |
yield 2; | |
yield 3; | |
yield 4; | |
yield 5; | |
} | |
let myIterator = generatorWithEnd(); | |
myIterator.next().value // 1 | |
myIterator.next().value // 2 | |
myIterator.next().value // 3 | |
myIterator.next().value // 4 | |
myIterator.next().value // 5 | |
myIterator.next().value // undefined | |
myIterator.next().done // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment