This construct is pretty useful to not overwrite existing data. Let's assume we're dealing with multiple Javascript files and we want to share some data on some object.
a.js
var share = window.share = share || { };
share.thisIsA = true;
b.js
var share = window.share = share || { };
share.thisIsB = true;
If we have even more than two files and we load those files asyncronously (we can't guarantee order) we don't overwrite that global share
object if it was defined and filled before. This is a very common practice for namespacing objects or config objects.
Another very common use case is for creating default values. For instance
function foo( option ) {
option = option || 'something';
if( option === 'foobar' ) {} // ...
}
There, we use the patter to have at least one known and defined value for our option argument, if the function gets called with out arguments. You can see that very often in plugin code for instance.