I came across the following code:
var f = function () {
var args = Array.prototype.slice.call(arguments).splice(1);
// some more code
};
Basically, the result in args
is an array that is a copy of the arguments
without its first element.
But what I can't understand exactly is why f
's arguments
(which is an object that holds the function's inputted arguments into an array-like object) object is being passed to the slice
method and how slice(1)
is removing the first element (positioned at index 0).
Can anyone please explain it for me?
P.S. The code is from this partial application function