Skip to content

Instantly share code, notes, and snippets.

@hoetmaaiers
Created February 9, 2017 15:16
Show Gist options
  • Save hoetmaaiers/e3f4a46f0d31f8d9dba2f87f9217de01 to your computer and use it in GitHub Desktop.
Save hoetmaaiers/e3f4a46f0d31f8d9dba2f87f9217de01 to your computer and use it in GitHub Desktop.
Fibonacci calculations
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