var dom = document.querySelector(".dom");
dom.onclick = fun2
functionfun2(){
console.log(this);}
对象中的this:对象本身
全局方法中this:window[setInterval,setTimeout]
箭头函数的this指向的是上一层作用域的this
var age =50;var obj ={name:"mumu",age:18,say:function(){
console.log(this.age);},grow:function(){setTimeout(()=>{this.age++;
console.log(this.age);},3000)}}
obj.grow();