Created
January 11, 2015 11:08
-
-
Save chrisbuttery/6fc62d61de7bc65b8bef to your computer and use it in GitHub Desktop.
generatorz
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 *write(){ | |
console.log('writing'); | |
var num = yield 1; | |
console.log('num x num =', num * num); | |
} | |
function *blah () { | |
console.log('starting blah'); | |
yield* write(); | |
console.log('ending blah'); | |
} | |
var it = blah(); | |
it.next(); | |
it.next(9); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment