Last active
June 9, 2017 00:51
-
-
Save Woodsphreaker/2da755e49e8b0e0218114ccc341e9db1 to your computer and use it in GitHub Desktop.
Fibonacci
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
const arrNumbers = (base = 10) => [...Array.from({"length" : base}).keys()] | |
const plus = (acc, cur, index) => acc.concat(index < 2 ? cur : acc[index - 2] + acc[index - 1]) | |
const fib = (base) => arrNumbers(base).reduce(plus, []) | |
console.log(fib(40)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment