Why does applying the slice method to the javascript arguments
value as follows Array.prototype.slice.call(arguments)
convert it to an array? If slice is used on arrays, and arguments
is not an array, then how does this work? Is it just a special case when slice
is applied to arguments?
| ||||
feedback
|
From the EcmaScript specification on
And so, | |||
feedback
|
Right, this is a trick that takes advantage of the fact that arguments are an enumerable list. It works on other enumerable lists too (for example nodelists). | |||
feedback
|