1.定时器中:this ->window
setInterval(function(){
*this*
},10)
2.函数中:this ->window
function a(){
console.log(*this*);
}
a();
3. this -> oDiv 对当前对象的引用
oDiv.onclick = function(){
*this*
}
4. this -> obj
var obj = {
name:'zs',
age:20,
say:function(){
console.log(this.name + "haha");
}
}
obj.say();
5. this -> new出来的实例化对象
function Person(){
this.name = 'zs';
}
var p1 = new Person();