The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Javascript
By Guest on 6th March 2019 02:50:30 AM | Syntax: JAVASCRIPT | Views: 78



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. var i;
  2. var fib = []; // Initialize array!
  3.  
  4. fib[0] = 0;
  5. fib[1] = 1;
  6. for (i = 2; i <= 10; i++) {
  7.   // Next fibonacci number = previous + one before previous
  8.   // Translated to JavaScript:
  9.   fib[i] = fib[i - 2] + fib[i - 1];
  10.   console.log(fib[i]);
  11. }



  • Recent Pastes
  • Jutt
    5 hours 59 mins 19 secs ago
  • Deneme
    6 hours 15 mins 40 secs ago
  • Jxixx
    9 hours 51 mins 15 secs ago
  • Jxixx
    9 hours 51 mins 24 secs ago
  • Payments Proof
    18 hours 4 mins 39 secs ago