Skip to content

Instantly share code, notes, and snippets.

@OleksivO OleksivO/post.js
Created Jan 16, 2019

Embed
What would you like to do?
the description for this gist
function* generatorFunction() {
yield 'First value';
yield 'Second value';
return 'Third value';
}
const iteratorObject = generatorFunction();
console.log(iteratorObject.next()) //{value: "First value", done: false}
console.log(iteratorObject.next()) //{value: "Second value", done: false}
console.log(iteratorObject.next()) // {value: "Third value", done: true}
console.log(iteratorObject.next()) // {value: "undefined, done: true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.