this指向问题:
ES5:var obj = {x:1,func:function(){console.log(this.x);},test:function(){//定时器为异步setTimeout(function(){alert(this);this.func();},10)}}obj.test();//定时器里的this永远指向于window//以前解决是使用var _this = this;es6:箭头函数的this始终指向我们定义时的thisvar obj = {x:1,func:function(){console.log(this.x);},test:function(){setTimeout(()=>{alert(this);//objthis.func();},10);}}obj.test();