摘要: 1.普通模式var person = new Object();person.name = "Laughing";person.age = 28;person.job = "Software Engineer";peron.sayName = function(){ alert(this.name);};person.sayName();缺点:创建多个对象时,会产生大量的重复代码。2.工厂模式function createPerson(name, age, job){ var o = new Object(); o.name = name; o.age 阅读全文
posted @ 2012-01-06 18:29 shinebob 阅读(175) 评论(0) 推荐(0) 编辑