Created
January 17, 2016 19:20
-
-
Save elycruz/f936364e0d5fbb17b9bb to your computer and use it in GitHub Desktop.
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
// Simple fibonacci series generator. Generates fibonacci series from 0 to `limit` number. | |
function fib (limit) { | |
var out = [], | |
a = 0, | |
b = 1; | |
while (a < limit) { | |
out.push(a); | |
if (b <= limit) { | |
out.push(b); | |
} | |
a = a + b; | |
b = a + b; | |
} | |
return out; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment