call和apply均用于this值绑定,区别在于参数列表
Function.apply(thisObj, args)Function.call(thisObj, [param1[, param2 [, param3 [... [,paramN]]]]])
前者传入参数列表(arguments),后者挨个向里边放参数
call、apply方法可以将一个函数的对象上下文从出事的上下文改编为由thisObj指定的新对象
此章作为this指向章节的补充
call和apply均用于this值绑定,区别在于参数列表
Function.apply(thisObj, args)Function.call(thisObj, [param1[, param2 [, param3 [... [,paramN]]]]])
前者传入参数列表(arguments),后者挨个向里边放参数
call、apply方法可以将一个函数的对象上下文从出事的上下文改编为由thisObj指定的新对象
此章作为this指向章节的补充