Created
October 5, 2016 07:58
-
-
Save ktrysmt/5bf6aee5d6a049b32cb01e15b042e1eb to your computer and use it in GitHub Desktop.
A simple snippet How to use es6 generator.
This file contains 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* f() { | |
yield 9 | |
yield 'home' | |
yield 'do not miss it!' | |
} | |
var bind = f() | |
console.log(bind.next(),bind.next(),bind.next(),bind.next()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment