3 ms·
The ES5 spec specifically allows (but doesn't require) implementations to create an Array.prototype.slice that accepts 'arguments': > NOTE: The slice function
by curveship 13y ago
The ES5 spec specifically allows (but doesn't require) implementations to create an Array.prototype.slice that accepts 'arguments':
> NOTE: The slice function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the slice function can be applied successfully to a host object [ed: 'arguments' is one such] is implementation-dependent. [0]
'arguments' isn't just array-like. It's got some very weird behavior. For instance, if your function also has named parameters, and you set an index on the arguments object that corresponds with a parameter, then it changes the value of the local parameter as well.
0 - http://es5.github.io/#x15.4.4.10 http://es5.github.io/#x15.4.4.10