Created
February 9, 2017 15:16
-
-
Save hoetmaaiers/e3f4a46f0d31f8d9dba2f87f9217de01 to your computer and use it in GitHub Desktop.
Fibonacci calculations
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 fib(end) { | |
const range = [0, 1]; | |
while (range[range.length - 1] < end) { | |
const prev = range[range.length - 1]; | |
const prevPrev = range[range.length - 2]; | |
range.push(prev + prevPrev); | |
} | |
return range; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment