-1

I need help I'm Stuck on the Fibonacci Sequence

function fibonacciGenerator (n) {
     var output=[];
     if(n === 1)
       output=[0];

     if(n==2)
       output=[0, 1];
    
     for(var i = 1; i< n; i++){
      output.push(output[output.length - 1] + output[output.length - 2]);  
     }
}
deepakchethan
  • 4,310
  • 1
  • 17
  • 29

0 Answers0