单例模式
function Universe() { //缓存实例 var instance = this; this.start_time = 0; this.bang = 'Big'; //重写改构造函数 Universe = function() { return instance; }; } Universe.prototype.nothing = true; // 测试 var uni = new Universe(); var uni2 = new Universe(); console.log(uni === uni2); // true console.log(uni.nothing) // true console.log(uni2.nothing) // true Universe.prototype.everything = true; console.log(uni.everything) // undefined console.log(uni2.everything) // undefined