Created
March 1, 2018 14:36
-
-
Save vldvel/5049ad1f96304e4b4cf7fc671ffcf391 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; | |
yield 2; | |
yield 3; | |
} | |
const gen = generator(); | |
gen.return(); // {value: undefined, done: true} | |
gen.return('Heeyyaa'); // {value: "Heeyyaa", done: true} | |
gen.next(); // {value: undefined, done: true} - all next() calls after return() will return the same output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment