Created
March 1, 2018 14:15
-
-
Save vldvel/30e8bed5bc407be90cfd295e049c9199 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.next(); // {value: 1, done: false} | |
| gen.next(); // {value: 2, done: false} | |
| gen.next(); // {value: 3, done: false} | |
| gen.next(); // {value: undefined, done: true} and all next calls will return the same output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment