Created
July 26, 2016 01:33
-
-
Save Ben52/c355ad444000e35e70dd199e41333f1f to your computer and use it in GitHub Desktop.
simple fibonacci function
This file contains hidden or 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 fb(steps, series = [], current = 1, last = 0) { | |
if(steps === 0) return series.reduce((a, b) => a + b); | |
return fb(--steps, series.concat(current), current + last, current) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment