I can see that the function is adding output[19] to output[18] to generate a sum of 4181, however why is the sum not 37?
function fibonacciGenerator(n) {
var output = [];
for (var i = 0; i < n; i++) {
if (i < 2) {
output.push(i)
} else {
output.push(output[output.length - 1] + output[output.length - 2])
}
}
console.log(output);
}
fibonacciGenerator(20);