Created
January 28, 2017 19:54
-
-
Save rinchik/2b0357eff0ae2398a44f6997853d6789 to your computer and use it in GitHub Desktop.
FibonacciGenerator.js
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* fibonacci(number) { | |
var previous_first = 0, previous_second = 1, next = 1; | |
while(true) { | |
next = previous_first + previous_second; | |
previous_first = previous_second; | |
previous_second = next; | |
yield next; | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment