JS基础总结 - call apply bind 方法对比

 

  参数1 参数2及之后参数 返回
.call( ) `this`绑定的对象 参数 执行结果
.apply( ) `this`绑定的对象 参数的数组 执行结果
.bind( ) `this`绑定的对象 参数 函数

 

 

示例:

// apply
add.apply(null, [1, 2]);

 

posted @ 2021-03-07 11:40  Better-HTQ  阅读(44)  评论(0编辑  收藏  举报