摘要: 1 function Universe() { 2 //缓存实例 3 var instance = this; 4 5 // 重写构造函数 6 Universe = function(){ 7 return instance; 8 }; 9 10 this.start_time = 0;11 this.bang = "Big";12 13 //保留原型属性14 Universe.prototype = thi... 阅读全文
posted @ 2013-09-02 17:44 楚玉 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 1 function Universe() { 2 //缓存实例 3 var instance = this; 4 5 this.start_time = 0; 6 this.bang = "Big"; 7 8 Universe = function(){ 9 return instance;10 };11 }12 13 //var uni = new Universe();14 //var uni2 = new Universe();15 ... 阅读全文
posted @ 2013-09-02 17:41 楚玉 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 1 2 3 4 5 借用方法/ 绑定 6 9 10 11 12 68 69 阅读全文
posted @ 2013-09-02 11:27 楚玉 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 借用构造函数 3 */ 4 5 //Article 6 function Article(){ 7 this.tags = ["js", "css"]; 8 } 9 Article.prototype.getTags = function(){10 return this.tags;11 };12 13 var article = new Article();14 15 //BlogPost16 function BlogPost(){}17 18 ... 阅读全文
posted @ 2013-09-02 11:07 楚玉 阅读(841) 评论(0) 推荐(0) 编辑