Skip to content

Instantly share code, notes, and snippets.

@rinchik
Created January 28, 2017 19:54
Show Gist options
  • Save rinchik/2b0357eff0ae2398a44f6997853d6789 to your computer and use it in GitHub Desktop.
Save rinchik/2b0357eff0ae2398a44f6997853d6789 to your computer and use it in GitHub Desktop.
FibonacciGenerator.js
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