I am trying to get a better grip on the JS syntax and I was wondering why it is common practice in many libraries to repeat the object name after a variable with that same name has already been declared. Please see below:
var Backbone = Backbone || {}; // <= Why the duplication?
or
var listeners = this._listeners || (this._listeners = {});
UPDATE:
After further research I have found a very well written article that evaluates many Idiomatic Expressions.
The article also explains the use behind Immediately Invoked Function Expressions (IIFE), i.e the wrapping of a function within a function, like such:
(function() {
console.log('Hello!');
})();
which is another one of those JS brainteasers that newbies like me can't quite understand.