Apply method confusion

is doing a question on Niuke.com. I encounter a problem:
to achieve the function callIt, after the call meets the following conditions
1, the returned result is the result after calling fn
2, and the call parameter of fn is all the parameters after the first parameter of callIt.
some people solve it in this way: (the first method can understand, why is the second method written in this way? Didn"t shift return the first element that was deleted? why is the apply method just called, and there is no sign of how fn is called? I don"t quite understand)
clipboard.png

Feb.26,2021

that's [] .shift.call (a)

that is, a.shift () , mainly arguments is not an array type, so you need to use call to change this of [] .shift () to arguments , so that argumengs can use the shift method.

< hr >
function callIt(){
 var fn = [].shift.call(arguments)
 var newArguments = arguments
 return fn.apply(null, newArguments)
}
Menu