Created
January 19, 2019 16:37
-
-
Save seekerlee/fdf661de31b39acca49b97394830287c to your computer and use it in GitHub Desktop.
JS fibonacci generator
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* fib() { | |
let a = 0, b = 1 | |
while(true) { | |
const tmp = a + b | |
yield tmp | |
a = b | |
b = tmp | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment