-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
都属于Function构造函数原型上的方法Function.prototype。
用途
call()调用一个函数,其具有一个指定的this值和参数列表。
apply()调用一个函数,其具有一个指定的this值,以及作为一个数组(或类似数组的对象)提供的参数。
var arr = [1,10,2,8];
Math.max.call(Math,...arr);
Math.max.apply(Math,arr);bind()创建一个新函数,当调用时,将其this关键字设置为提供的值,在调用新函数时,在任何提供之前提供一个给定的参数序列。
call和apply都是为了动态改变this,当一个object没有某个方法,
Reactions are currently unavailable