I was working with sublime text 3 and running my code with node build system.When I have updated nodeJS to v10, the problems began.
Node Build system :
{
"cmd": ["C:/Program Files/nodejs/node.exe","$file"],
"selector": "source.js"
}
The console shows this error:
console.log(window);
^
ReferenceError: window is not defined
at Object.<anonymous> (C:\Users\mhsn67\Documents\Front End NanoDegree\Example\Background-generator\app.js:3:13)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
at Function.Module._load (internal/modules/cjs/loader.js:703:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
at internal/main/run_main_module.js:17:11
[Finished in 0.2s]
window, which is part of the Browser/DOM API...windowis browser's object not Nodejs'. So if you were not having an error then you were declaring it before then