js中call、apply、bind的用法
var zlw = {
name: "zlw",
sayHello: function (age) {
console.log("hello, i am ", this.name + " " + age " years old");
}
};
var xlj = {
name: "xlj",
};
zlw.sayHello(24);// hello, i am zlw 24 years old
zlw.sayHello.call(xlj, 24);// hello, i am xlj 24 years old
zlw.sayHello.apply(xlj, [24]);// hello, i am xlj 24 years old
zlw.sayHello.bind(xlj, 24)(); //hello, i am xlj 24 years old
zlw.sayHello.bind(xlj, [24])(); //hello, i am xlj 24 years old
相關文章
- JS中的call、apply、bindJSAPP
- apply,call,bind的用法APP
- JS中的call、apply、bind方法JSAPP
- 理解JS中的call、apply、bind方法(********************************************************JSAPP
- js中call、apply、bind的區別JSAPP
- js中call、apply、bind函式JSAPP函式
- javascript中call()、apply()、bind()的用法終於理解JavaScriptAPP
- JavaScript中apply、call、bind的區別與用法JavaScriptAPP
- JS中apply和call的用法JSAPP
- apply call bind的用法與實現APP
- JavaScript中bind、call、apply函式用法詳解JavaScriptAPP函式
- JavaScript 中的 apply、call、bindJavaScriptAPP
- js call、apply、bind的實現JSAPP
- 重寫JS中的apply,call,bind,new方法JSAPP
- js call,apply,bind總結JSAPP
- 【譯】理解this及call,apply和bind的用法APP
- JS中bind、call和apply的作用以及在TS裝飾器中的用法JSAPP
- js call apply bind簡單的理解JSAPP
- this、apply、call、bindAPP
- 模擬js中的call、apply和bind的實現JSAPP
- 手寫JS函式的call、apply、bindJS函式APP
- 理解JS函式之call,apply,bindJS函式APP
- 回味JS基礎:call apply 與 bindJSAPP
- Javascript - apply、call、bindJavaScriptAPP
- this, call, apply 和 bindAPP
- JS中改變this的指向 call、apply 和 bind 的區別JSAPP
- JavaScript中call,apply,bind方法的總結。JavaScriptAPP
- 談談JavaScript中的call、apply和bindJavaScriptAPP
- 淺談JavaScript中的apply、call和bindJavaScriptAPP
- JavaScript中call,apply,bind方法的總結JavaScriptAPP
- js中的call、applyJSAPP
- JS中的call()方法和apply()方法用法總結JSAPP
- js深入之實現call、apply和bindJSAPP
- apply & call & bind 原始碼APP原始碼
- bind/call/apply 深度理解APP
- 手寫call,apply,bindAPP
- call、apply、bind 區別APP
- apply call bind 簡介APP