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
2010-10-28 13:13:37
You're welcome! Too bad you can't post comments yet.
Roatin Marth
2010-10-28 13:18:39
I liked your answer better. "Assigning a reference" is more accurate
Phil Brown
2010-10-28 13:20:36
+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
2010-10-28 14:05:19