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
- javascript中call()、apply()、bind()的用法終於理解JavaScriptAPP
- JavaScript中apply、call、bind的區別與用法JavaScriptAPP
- apply call bind的用法與實現APP
- js call、apply、bind的實現JSAPP
- 重寫JS中的apply,call,bind,new方法JSAPP
- JavaScript 中的 apply、call、bindJavaScriptAPP
- 【譯】理解this及call,apply和bind的用法APP
- JS中bind、call和apply的作用以及在TS裝飾器中的用法JSAPP
- this、apply、call、bindAPP
- 模擬js中的call、apply和bind的實現JSAPP
- 手寫JS函式的call、apply、bindJS函式APP
- 理解JS函式之call,apply,bindJS函式APP
- Javascript - apply、call、bindJavaScriptAPP
- this, call, apply 和 bindAPP
- JS中改變this的指向 call、apply 和 bind 的區別JSAPP
- JS中的call()方法和apply()方法用法總結JSAPP
- js深入之實現call、apply和bindJSAPP
- JavaScript中call,apply,bind方法的總結。JavaScriptAPP
- 淺談JavaScript中的apply、call和bindJavaScriptAPP
- 談談JavaScript中的call、apply和bindJavaScriptAPP
- js之call,apply和bind的模擬實現JSAPP
- 手寫call,apply,bindAPP
- call、apply、bind 區別APP
- apply call bind 簡介APP
- call apply bind區別APP
- apply & call & bind 原始碼APP原始碼
- bind/call/apply 深度理解APP
- JavaScript-apply、bind、callJavaScriptAPP
- this指向與call,apply,bindAPP
- 手寫call、apply、bindAPP
- js中call,apply和bind方法的區別和使用場景JSAPP
- 從一行等式理解JS當中的call, apply和bindJSAPP
- 「乾貨」細說 call、apply 以及 bind 的區別和用法APP
- call,apply和bind的區別APP
- JS學習筆記之call、apply的用法JS筆記APP