call apply bind
相同点: 都可以改变this指向
不同点: apply的第二个参数是 数组
不同点: bind需要二次调用
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 函数中的 this 变成了{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();