Created
June 14, 2014 06:50
-
-
Save miensol/9cf18bc90b2021018403 to your computer and use it in GitHub Desktop.
a simple es6 generator
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
var sequence = function *() { | |
yield 1; | |
yield 2; | |
}; | |
var sequenceGenerator = sequence(); | |
var current = null; | |
current = sequenceGenerator.next(); | |
console.log(current); | |
current = sequenceGenerator.next(); | |
console.log(current); | |
current = sequenceGenerator.next(); | |
console.log(current); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment