One should never write "var x = x || {};" per se.
The only circumstance where this is not identical to "var x = {};" is when x was previously initialized in the same scope. That is immoral. Note:
function() {
x = {foo:"bar"};
var x = x || {};
}
Is the same as, merely more confusing than,
function() {
var x = {foo:"bar"};
x = x || {};
}
In neither case is there any reference to the value of the symbol "x" in the global scope.
This expression is a confused variant of the legitimate lazy property initialization idiom:
function( foo ) {
foo.x = foo.x || {};
foo.x.y = "something";
}