I cannot find the reason behind this format?
I assume it is to check if this variable has been created before and if so, to take that one rather than the blank object.
But I cannot think HOW or WHY this would already exist when I am assigning this.
I cannot find the reason behind this format?
I assume it is to check if this variable has been created before and if so, to take that one rather than the blank object.
But I cannot think HOW or WHY this would already exist when I am assigning this.
 
    
    The notation performs exactly as you suggest.
This is really for cases where you might have multiple javascript includes which could potentially create the same object, and you do not want to clobber the object that might already be defined.
 
    
    You are right in your assumption that it will default to the existing variable if it exists, or otherwise create a new object.
Without seeing the code, it is a little difficult to tell how it could initialized previously, but it is typically used for modules/constructors that may already have been called. The purpose is to use a "singleton" rather than a new instance when that function is executed.
