Possible Duplicate:
What does “var FOO = FOO || {}” mean in Javascript?
Javascript – Can you add condition to variable declaration
I believe this has to do with scoping, and not redefining scope. I see a lot of this in popular javascript frameworks:
var something = something || {};
Is that to do with not accidentally redefining a top-level variable?
You are correct. If the variable already exists (ours or not), don’t change it. If it doesn’t exist, let’s create a new one.