I was trying to understand the point of var myObj = myObj || {};
and found this and this article explaining it. But I still don't see the situation in which I'd need it. Those articles seem to address the actual logic of it as its equivalence to a ? a : b
- I get that.
For example, I'm creating a HUD for my game,
game.HUD = game.HUD || {};
game.HUD.Container = me.Container.extend({
//...
Why can't I just create the object without using game.HUD = game.HUD || {};
?