Globals
Globals you actually use: console, process, Buffer, setTimeout, __dirname / __filename in CommonJS. In ESM, __dirname is not free — use import.meta.url.
process.env.PORT for config. Don’t dump secrets in source.
Trap — assuming window exists in Node. That’s the browser.
Exam tip
process.env.PORT. No window. __dirname in CommonJS.