Created
December 11, 2014 16:47
-
-
Save jergason/df67f6d4510cee4f9fc9 to your computer and use it in GitHub Desktop.
generators
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
function* generator() { | |
yield 1; | |
yield 2; | |
yield 3; | |
yield 4; | |
} | |
var i = generator(); | |
var next = {}; | |
while (!next.done) { | |
console.log(next); | |
next = i.next(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment