- function SingeInstance(){
- if(!SingeInstance._instance)
- SingeInstance._instance=this;
- return SingeInstance._instance;
- }
- var obj1=new SingeInstance();
- var obj2=new SingeInstance();
- console.log(obj1===obj2); //true
- //该片段来自于http://www.codesnippet.cn/detail/1304201512243.html
来源: http://www.codesnippet.cn/detail/1304201512243.html