<script>
function Animal(name,age){
this.name=name;
this.age=age;
}
var that;
Animal.prototype.eat=function(){
console.log('我在吃午饭');
that=this;
}
var dog=new Animal('旺财',5)
dog.eat()
console.log(that===dog);
</script>
老哥,我也没执行方法,但我是true
dog.eat() 不执行这个的话 that 是 undefined
this 是 dog对象 两者比较肯定是 false。
如果执行了 eat 方法 that=this 进行了对象赋值 所有是相等的
浏览器上测试正常