Created
March 12, 2017 18:50
-
-
Save mightyguava/8e8b5153a321be9517976bdfe9437a95 to your computer and use it in GitHub Desktop.
Demystifying Async Programming in Javascript - Generator internals adder
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* adder(initialValue) { | |
let sum = initialValue; | |
while (true) { | |
sum += yield sum; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment