I am struggling with understanding the code for a Fibonacci Generator. What is the purpose of i++ and y++ in this context, and how do they contribute to generating the sequence? :(
function fibonacciGenerator(n) {
var fib = [0, 1];
var i = 0;
var y = 1;
if (n === 1) {
fib.pop();
} else {
for (var i = 0; fib.length < n; i++) {
fib.push(fib[i] + fib[y]);
y++;
}
}
return fib;
}