Skip to content

Instantly share code, notes, and snippets.

@Woodsphreaker
Last active June 9, 2017 00:51
Show Gist options
  • Save Woodsphreaker/2da755e49e8b0e0218114ccc341e9db1 to your computer and use it in GitHub Desktop.
Save Woodsphreaker/2da755e49e8b0e0218114ccc341e9db1 to your computer and use it in GitHub Desktop.
Fibonacci
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