Created
December 27, 2019 11:24
-
-
Save behnamazimi/5a7dc5bb22ac1184f3b883ca66ff15dc to your computer and use it in GitHub Desktop.
This file contains hidden or 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 * myGenerator() { | |
// ... maybe some codes here | |
yield 'First Pause'; | |
// ... maybe some codes here | |
yield 'Second Pause'; | |
} | |
const it = myGenerator(); | |
console.log(it.next()); //o: {value: "First Pause", done: false} | |
console.log(it.next()); //o: {value: "Second Pause", done: false} | |
console.log(it.next()); //o: {value: undefined, done: true} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment