<script>
function Person(a, b, c)
{
this.a = a;
this.b = b;
this.c = c;
}
var p = Person(1,2,3);
alert(this.a); // alert(a);
</script>
这个时候的Person()调用只是给js的window对象的增加了3个属性a,b,c。
所以如果访问alert(p.a); 会出现undefined
<script>
function Person(a, b, c)
{
this.a = a;
this.b = b;
this.c = c;
}
var p = new Person(1,2,3);
alert(p.a);
</script>
所以访问alert(p.a);有效,访问this.a反而无效了。