You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
var fibonacci_series = function (n)
|
|
{
|
|
if (n===1)
|
|
{
|
|
return [0, 1];
|
|
}
|
|
else
|
|
{
|
|
var s = fibonacci_series(n - 1);
|
|
s.push(s[s.length - 1] + s[s.length - 2]);
|
|
return s;
|
|
}
|
|
};
|
|
|
|
console.log(fibonacci_series(8));
|