descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com
Found Array.prototype.slice.apply in some inherited code. Why would you use the Array type's prototype method? Apparently to slice Array-like objects that aren't really arrays. Why Array's slice works with the non-but-almost-arrays, I don't know.
There you go Array.prototype.slice.apply(arguments) converts arguments into an ARRAY.
Here we use one of the methods to call a function in JavaScript, the APPLY method, you can learn more about how to call a function in JS here. So we apply the slice function to the first argument of the apply function(in this case “arguments”) and we know that the slice() method returns always an Array. We got our Array!
The DOM usually returns a NodeList for most operations like getElementsByTagName.
Although a NodeList almost feels like an array, it is not. It has a length property like an array does, and a method item(index) to access an object at the given index (also accessible with the [index] notation), but that's where the similarity ends.
So to be able to use the wonderful array methods without rewriting them all for a NodeList, the above line is useful.