Why am I getting the addresses of the array instead of the values?
x = [0];
y = [0,1];
function myFunc(n) {
while (n >= x.length) {
i = (y.slice(-1))
x.push(i);
}
console.log(x)
}
myFunc(3)
Running the function and I get this:
[0, Array(1), Array(1), Array(1)]
Expect to get:
[0, 1, 1]