Skip to content

Instantly share code, notes, and snippets.

@joemaffei
Created February 19, 2019 05:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joemaffei/f1f9c0b38b991452fca97488c081267d to your computer and use it in GitHub Desktop.
Save joemaffei/f1f9c0b38b991452fca97488c081267d to your computer and use it in GitHub Desktop.
Calculate nth Fibonacci number
function fibonacci(n) {
return Math.round((Math.pow(1.618033988749895, n) - Math.pow(-0.618033988749895, n)) / 2.23606797749979);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment