This is the code to do a Fibonacci Generator. I cannot understand what the i++ and y++ are doing and how all this is resulting in giving us 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;
}