//代码一:
var a = 1;
var foo = {
a: 2,
bar: function () {
return this.a;
}
}
console.log(foo.bar());//2
//代码二:
var a = 1
var foo = {
bar: function () {
return this.a;
}
}
console.log(foo.bar());//undefined
原文:https://www.cnblogs.com/xjt31/p/14031927.html