1.

How to calculate the Fibonacci series in JavaScript?

Answer»

Here's the CODE to CALCULATE the FIBONACCI series in JS code:

Example

var the_fibonacci_series = FUNCTION (n)
{
  if (n===1)
  {
    return [0, 1];
  }
  ELSE
  {
    var a = the_fibonacci_series(n - 1);
    a.push(a[a.length - 1] + a[a.length - 2]);
    return a;
  }
};

console.log(the_fibonacci_series(9));



Discussion

No Comment Found