你的位置:首页 > 软件开发 > Java > js模式(一):单例模式

js模式(一):单例模式

发布时间:2015-04-30 00:00:27
function Universe(){ var instance; Universe = function (){ return instance; } Universe.prototype = this; console.l ...

 

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模式(一):单例模式

关键词:JS

JS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。