If the arguments are just an object with the length property, then why does it seem to behave differently than other objects without an array, for example, in Array.prototype.slice.
For example, the following code first warns "undefined" and then warns "foo". Why are they different?
(function(a){ var myobj = {0 : "foo"}; var myobjarray = Array.prototype.slice.call(myobj); var argumentsarray = Array.prototype.slice.call(arguments); alert(myobjarray.shift()); alert(argumentsarray.shift()); })("foo");
javascript arrays
zjmiller
source share