Skip to content

Instantly share code, notes, and snippets.

@bdkaat
Created May 24, 2015 02:37
Show Gist options
  • Select an option

  • Save bdkaat/d69ce5e1d564d693bdff to your computer and use it in GitHub Desktop.

Select an option

Save bdkaat/d69ce5e1d564d693bdff to your computer and use it in GitHub Desktop.
Function for displaying Fibonacci Sequence to desired amout of places
var Fibonacci = function(number) {
var a = 1, b = 1, c = 2;
console.log(a);
console.log(b);
console.log(c);
for(var i = 2; i <= number; i++) {
c = b + c;
a = b;
b = c - b;
console.log(c);
}
}
Fibonacci(number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment