It is common to see this line in books or snippets, [].slice.call(arguments, 1); I didn’t know what it meant at first, so I decided to learn.

In the code

function test() {
 // Intercepts parameters
    // Let Pointers to arrays of arguments inherit from [array] to use various methods of [];
    // Args objects are arrays processed by slice
    var args = [].slice.call(arguments.1);
    console.log(args,"first");
    // Es6 extension operators can achieve the same effect, first array, then intercept;
    var args = [...arguments].slice(1);
    console.log(args,"second");
}
test(1.2.3.4.5.6.7);
test([1.2.3.4.5.6], [1111] and {name:1234});
Copy the code

run

[].slice.call(arguments,1) is used to handle function arguments.