Last active
January 28, 2017 17:39
-
-
Save rinchik/a832e30b1ace922437a03ea383ba777a to your computer and use it in GitHub Desktop.
FibonacciLoop.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 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