Created
March 2, 2018 06:52
-
-
Save vldvel/322bf7ea95d48b07993db3293db074e4 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
function * generator() { | |
yield 1; | |
return 2; | |
yield 3; // we will never reach this yield | |
} | |
const gen = generator(); | |
gen.next(); // {value: 1, done: false} | |
gen.next(); // {value: 2, done: true} | |
gen.next(); // {value: undefined, done: true} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment