Last active
March 1, 2018 14:23
-
-
Save vldvel/5895c294de1894b032ff48a1ff64f044 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(arg = 'Nothing') { | |
yield arg; | |
} | |
const gen0 = generator(); // OK | |
const gen1 = generator('Hello'); // OK | |
const gen2 = new generator(); // Not OK | |
generator().next(); // It will work, but every time from the beginning |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment