JS实现单例模式 1 function Singleton(){ 2 if(!Singleton.a){ 3 Singleton.a={}; 4 } 5 return Singleton.a; 6 }运行结果: