this
函数预编译过程 this ——> window
全局作用域里this ——> window
call/apply 可以改变函数运行时this的指向
obj.func() ; func()里面的this 指向obj;
let name = '222';
let a = {
name : '123',
say : function(){
console.log(this.name);
}
}
let fun = s.say;
fun(); //222
a.say(); //123
let b = {
name : '333',
say : function(fun){
fun();
}
}
b.say(a.say); //222
b.say = a.say;
b.say(); //333