First, a pseudo code example:
;(function(foo){
foo.init = function(baz) { ... }
foo.other = function() { ... }
return foo;
}(window.FOO = window.FOO || {}));
Called like so:
FOO.init();
My question:
What is the technical name/description of: window.FOO = window.FOO || {}?
I understand what the code does... See below for my reason(s) for asking.
Reason for asking:
I'm calling the passed in global like so:
;(function(foo){
... foo vs. FOO, anyone else potentially confused? ...
}(window.FOO = window.FOO || {}));
... but I just don't like calling that lowercase "foo", considering that the global is called capitalized FOO... It just seems confusing.
If I knew the technical name of this technique, I could say:
;(function(technicalname){
... do something with technicalname, not to be confused with FOO ...
}(window.FOO = window.FOO || {}));
I've seen a recent (awesome) example where they called it "exports":
;(function(exports){
...
}(window.Lib = window.Lib || {}));
I guess I'm just trying to standardize my coding conventions... I'd like to learn what the pros do and how they think (that's why I'm asking here)!