Created
August 16, 2016 18:40
-
-
Save robbestad/549958480847c80e77ecf4bfba0fb10b 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() { | |
| let i = 0; | |
| while (true) { | |
| yield ++i % 2 === 0; | |
| } | |
| } | |
| const gen = generator(); | |
| for (let i = 0; i < 5; i++) { | |
| console.log(gen.next().value); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment