call apply bind

每个函数都包含两个非继承而来的方法call() apply()

用途:在特定的作用域中调用函数,实际等于设置函数体内this对象的值


  1. apply call

apply方法接收两个参数:在其中运行函数的作用域 参数数组

第二个参数可以是Array的实例,也可以是arguments对象

第一个参数是null undefined 指向window global 
(严格模式指向 null undefined)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324690088&siteId=291194637