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