Skip to content

Instantly share code, notes, and snippets.

@btg5679
Created July 11, 2018 01:09
Show Gist options
  • Save btg5679/d830f0067e5ae1610459131d38ce636e to your computer and use it in GitHub Desktop.
Save btg5679/d830f0067e5ae1610459131d38ce636e to your computer and use it in GitHub Desktop.
function* sample() {
yield "simple";
yield "generator";
}
var it = sample();
console.log(it.next()); // {value: 'simple, done: false}
console.log(it.next()); // {value: 'generator, done: false}
console.log(it.next()); // {value: undefined, done: true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment