Skip to content

Instantly share code, notes, and snippets.

@chamatt
Created July 14, 2022 06:23
Show Gist options
  • Save chamatt/592363bc83e3d2db0edb5359230f6cca to your computer and use it in GitHub Desktop.
Save chamatt/592363bc83e3d2db0edb5359230f6cca to your computer and use it in GitHub Desktop.
const fibRange = n => [...Array(n).keys()].reduce((acc) => acc.concat(acc.at(-1) + acc.at(-2)), [0,1])
const fib = n => fibRange(n)[n]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment