Now imagine this in your code, where you might need something external
Function('return this')()
will return ALWAYS the REAL window object
Running the function function(window, undefined){}
will ensure that window
is THE window
Also, since you only passed 1 parameter, the 2nd parameter will have no value
The value for that is undefined
This will avoid var undefined=5; [code] var five=5; alert(five == undefined);
Ensuring that undefined
is REALLY undefined.
Even if you don't use those variables, doing this will keep your local variables as local, and improve performance, since they aren't being added to the window
object.