Skip to content

Instantly share code, notes, and snippets.

@squalvj
Created July 25, 2019 05:22
Show Gist options
  • Save squalvj/e1ac223847bd8c17dd1d6d44a560a863 to your computer and use it in GitHub Desktop.
Save squalvj/e1ac223847bd8c17dd1d6d44a560a863 to your computer and use it in GitHub Desktop.
Fibonacci on js
function fibonacci(num){
var a = 1, b = 0, temp;
while (num >= 0){
temp = a;
a = a + b;
b = temp;
num--;
}
return b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment