Created
July 1, 2019 01:04
-
-
Save kunigami/85823340ed225aa9b39c4fd20c3b92a8 to your computer and use it in GitHub Desktop.
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* makeGenerator(n) { | |
for(cnt = n - 1; cnt >= 0; cnt--) { | |
yield cnt; | |
} | |
} | |
it = makeGenerator(30); | |
while (true) { | |
const {value, done} = it.next(); | |
if (done) { | |
break; | |
} | |
console.log(value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment