Skip to content

Instantly share code, notes, and snippets.

@theWhiteFox
Created July 2, 2017 17:29
Show Gist options
  • Save theWhiteFox/845d097a8bed4ac42e450bc4ddf628f9 to your computer and use it in GitHub Desktop.
Save theWhiteFox/845d097a8bed4ac42e450bc4ddf628f9 to your computer and use it in GitHub Desktop.

Revisions

  1. Ó Conchubhair ♔ created this gist Jul 2, 2017.
    13 changes: 13 additions & 0 deletions fibonacci.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    // 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;
    }