Skip to content

Instantly share code, notes, and snippets.

@domachine
Created February 3, 2016 14:14
Show Gist options
  • Save domachine/01404c98738f41b3c30f to your computer and use it in GitHub Desktop.
Save domachine/01404c98738f41b3c30f to your computer and use it in GitHub Desktop.
function *myGenerator() {
const a = yield 2;
return a;
}
const it = myGenerator();
it.next(); // => { value: 2, done: false }
it.next('hello') // => { value: 'hello', done: true }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment