Skip to content

Instantly share code, notes, and snippets.

@rinchik
Last active January 28, 2017 17:39
Show Gist options
  • Save rinchik/a832e30b1ace922437a03ea383ba777a to your computer and use it in GitHub Desktop.
Save rinchik/a832e30b1ace922437a03ea383ba777a to your computer and use it in GitHub Desktop.
FibonacciLoop.js
function fibonacci(number) {
var sequence = [1, 1];
for (var i = 2; i < number; i++) {
sequence[i] = sequence[i-1]+ sequence[i-2];
}
return sequence[number-1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment