Skip to content

Instantly share code, notes, and snippets.

@theWhiteFox
Created July 2, 2017 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theWhiteFox/845d097a8bed4ac42e450bc4ddf628f9 to your computer and use it in GitHub Desktop.
Save theWhiteFox/845d097a8bed4ac42e450bc4ddf628f9 to your computer and use it in GitHub Desktop.
// enter a number
function fibonacci(num) {
var a = 1, b = 0, temp2;
while(num > 0) {
temp2 = a;
a = a + b;
b = temp2;
num--;
console.log(temp2);
}
return b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment