????????????call?apply??bind
????????????相同點(diǎn):?都可以改變this指向?????
? ? ? ? ?不同點(diǎn):?apply的第二個(gè)參數(shù)是?數(shù)組?
? ? ? ? ?不同點(diǎn):??bind需要二次調(diào)用
????????var?obj?=?{
????????????name:'zhangsan',
????????????say:function(str,str2){
????????????????console.log(this.name+'?'+str+'?'+str2)??//?this??{name:'李二'}
????????????}
????????}
????????//?obj.say('hello')
????????//?obj.say.call({name:'李二'},'hello','world');//?obj.say?函數(shù)中的?this?變成了{(lán)name:'李二'’}
????????//?obj.say.apply({name:'李二'},['hello','world'])
???????var?f?=??obj.say.bind({name:'李二'},'hello','world');
???????f();
????????//?var?obj2?=?{
????????//?????name:'王武',
????????//?????setname:function(){
????????//?????????//?console.log(this);??//this??obj2
????????//?????????obj.say.call(this);??//?obj2:{}
????????//?????}
????????//?}
????????//?obj2.setname();