摘要: 一般构造函数定义和调用如下:function Person(name,age,job){ this.name=name; this.age=age; this.job=job;}var person=new Person('thinksley',24,'web developer');console.log(person.name); //thinksley而如果实例化对象的时候不用new的话,this会映射到全局的window对象上,这时候person.name就会变成undefined了,要把对象改成window:function Person(name,a 阅读全文
posted @ 2013-02-24 12:35 TL_LEE 阅读(142) 评论(0) 推荐(0) 编辑