Here is some of my javascript:
(function(window) {
window.file = {};
file.i = 0;
for(;;) {
if(file.i++ >= 10) break;
document.body.appendChild(document.createTextNode(file.i))
}
}) ();
Why is window undefined?
You need to call the anonymous function with window as the first argument:
(function(window) {
window.file = {};
file.i = 0;
for(;;) {
if(file.i++ >= 10) break;
document.body.appendChild(document.createTextNode(file.i))
}
}) (window);
Since you provided nothing, window inside of your function's scope was considered undefined.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With