So this is my code:
function A(){
var args = Array.prototype.slice.call(arguments);
console.log('before unshift: ', args);
args.unshift(3);
console.log('after unshift:', args);
}
Now, when I call it:
A(1, 2, 3)
the result in the console is:
before unshift: [3, 1, 2, 3]
after unshift: [3, 1, 2, 3]
“before unshift” should be [1,2,3] though…?
…Anyone know why?
———- USING: Chrome’s Developer Tools ———-
The console, at least in WebKit’s Web Inspector, outputs “live” views of arrays, not snapshots of them at the time the log happened.
To get one of those, do
For the case of objects (which presumably subsumes arrays), this is WebKit bug #35801.