Created
January 22, 2016 07:50
-
-
Save shuding/d0f3536249c153733a52 to your computer and use it in GitHub Desktop.
Counting
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
var y = count(); | |
y.next(); | |
function *count() { | |
yield setTimeout(() => { console.log(1); y.next(); }, 1000); | |
yield setTimeout(() => { console.log(2); y.next(); }, 1000); | |
yield setTimeout(() => { console.log(3); y.next(); }, 1000); | |
yield setTimeout(() => { console.log(4); y.next(); }, 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment