摘要: 1工厂模式工厂模式是软件领域一种广为人知的设计模式废话少说直接贴代码 1 function createPerson(name,age,job){ 2 var 0 = {}; 3 o.name = name; 4 o.age = age; 5 o.job = job; 6 o.sayName = function(){ 7 alert(this.name) 8 }; 9 return o;10 }11 var person1 = createPerson("sunhaixun",29,"web");12 var perso... 阅读全文
posted @ 2011-09-07 20:13 孙海勋 阅读(187) 评论(0) 推荐(0) 编辑
摘要: var a = [0,1,2];var b =a ;alert(b);a[0] = 4;alert(b)修改的a会影响到b基本类型保存的是值 所以不会被影像到var a =5;var b= a;a = 6;alert(b) 阅读全文
posted @ 2011-09-07 11:25 孙海勋 阅读(167) 评论(0) 推荐(0) 编辑