What does “var FOO = FOO || {}” (assign a variable or an empty object to that variable) mean in Javascript?

Your guess as to the intent of || {} is pretty close. This particular pattern when seen at the top of files is used to create a namespace, i.e. a named object under which functions and variables can be created without unduly polluting the global object. The reason why it’s used is so that if … Read more