指当前调用的对象:4种绑定规则:默认绑定、隐式绑定、显式绑定、new绑定,优先级从低到高
var person = {
name:'zhangsan',
age:20,
getName:function(){
console.log(this.name);
},
getAge:function(){
function aa() { //局部函数
console.log(this+' '+this.age);//局部函数this指向window
}
aa();
console.log(this+' ' + this.age);
}
};
person.getName();
person.getAge();