码迷,mamicode.com
首页 > Web开发 > 详细

js模式(一):单例模式

时间:2015-04-30 00:48:14      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:

 

function Universe(){
         var instance;
         Universe = function (){
             return instance;
         }
         Universe.prototype = this;
         console.log(Universe);
         instance = new Universe();
         instance.constructor = Universe;

         instance.start_time = 0;
         instance.bng ="dd";
         return instance;
     }

     Universe.prototype.nothint = 1;
      console.log(Universe);
     var a = new Universe();
 console.log(Universe);
     var b = new Universe();

单例模式

js模式(一):单例模式

标签:

原文地址:http://www.cnblogs.com/danghuijian/p/4467699.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!