Why is the array returning it as if all of the array.shift()'s were performed first, then the console.log()'s?
Here is my code:
var y = [1,2,3,4,5,6];
y.shift();
console.log(y);
y.shift();
console.log(y);
y.shift();
console.log(y);
I would expect this to be the output:
[2,3,4,5,6]
[3,4,5,6]
[4,5,6]
But this is what I am currently getting:
[4,5,6]
[4,5,6]
[4,5,6]
Any idea what is going on here?