Created
July 22, 2014 06:28
-
-
Save itsananderson/47a5db2b1b99821c8eba to your computer and use it in GitHub Desktop.
Fibonacci generator in ES6
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() { | |
var a = 0; | |
var b = 1; | |
while(true) { | |
yield a; | |
b = a+b; | |
a = b-a; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment