I just saw this question into which someone passed window.Module = window.Module || {}
into a function.
For example:
(function(module){
// do something with module
})(window.Module = window.Module || {});
I understand that if window.Module
is undefined (or false for that matter) then {}
would be passed in, but what is the point in setting window.Module
equal to itself?
For people posting answers:
I read the code as:
if(!(window.Module = window.Module)) {
// pass {} into function
}
else {
// pass window.Module = window.Module into function
// (which makes NO sense to me)
}