Created
January 16, 2019 20:00
-
-
Save OleksivO/2e1d88bc9f77171444dad262ab759edb to your computer and use it in GitHub Desktop.
the description for this gist
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* 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