tags:

views:

94

answers:

3

var a = window.a || {};

+6  A: 

It means a will be assigned window.a if it is not null or undefined, otherwise, it will equal an empty object

Phil Brown
A: 

Thanks for the useful info!

AaronAdamic
You're welcome! Too bad you can't post comments yet.
Roatin Marth
I liked your answer better. "Assigning a reference" is more accurate
Phil Brown
+1  A: 

To answer the unasked question: this is used to make sure "a" will be valid.

Without it, when calling a.someFieldHere you might get exception saying "a is undefined", with such code in place you won't get such error.

It's useful when "a" is created elsewhere in some other code that not always get executed.

Kind of insurance policy. :)

Shadow Wizard