Javascript add extra argument

后端 未结 11 1038
暖寄归人
暖寄归人 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:16

    In this case it could be more comfortable to use call() instead of apply():

    function first(parameter1, parameter2) {
    
      var parameter3 = "123";
    
      secondFunction.call(
        this,
        parameter1,
        parameter2,
        parameter3);
    },
    

提交回复
热议问题