第一种,this指向的是a对象
<html>
<script>
var name = "111";
var a = {
name : "123",
b : function (){
console.log(this.name);//123
}
}
a.b();
</script>
</html>
第二种,this指向的是window
<html>
<script>
var name = "111";
var a = {
name : "123",
b : this.name
}
console.log(a.b);//111
</script>
</html>
不是说哪个对象调用的就是谁的this吗,为啥还和作用域扯上关系了