If you run javascript outside of the browser, you do not have to have a window object. For example, nodejs scripts do not have a window object, but they do have a global process object.
, , ...
(function(){ var window = undefined; console.log(this); console.log(window) }).apply({});
window, , .
, ...
(function(){ var window = undefined; (function(){
console.log(this);
console.log(window);
}).apply({}); })();
EDIT: ...
;(function(){
var globals = Object.keys(this);
for(i in globals){
if(globals[i] !== "console"){
eval("var " + globals[i]);
};
};
;(function(){
console.log(this);
console.log(window);
}).apply({});
})();