Singleton Pattern with {}?
问题 I apologize to move it from here as there was some confusion and thanks to Grey for answer this to realized the mistake. The topic has been moved to Javascript: Behavior of {} to discuss further. Singleton Pattern with '{}'. Here how it is: var A = { B : 0 }; // A is an object? document.write("A is an " + typeof A); Lets try to clone object A var objectOfA = new Object(A); objectOfA.B = 1; //Such operation is not allowed! //var objectOfA = new A(); var referenceOfA = A; referenceOfA.B = -1;