Javascript add extra argument

后端 未结 11 1039
暖寄归人
暖寄归人 2021-02-06 22:02

Lets take a look at this code:

var mainFunction = function() {
  altFunction.apply(null, arguments);
}

The arguments that are passed to \"mainF

11条回答
  •  粉色の甜心
    2021-02-06 22:07

    The arguments object isn't an array; it's like an array, but it's different. You can turn it into an array however:

    var mainArguments = [].slice.call(arguments, 0);
    

    Then you can push another value onto the end:

    mainArguments.push("whatever");
    

提交回复
热议问题