In the browser and the NodeJS REPL the following prints true
, but running as a file (ie. node filename.js
) under NodeJS it prints false
. Why?
All in non-strict mode, in the global context.
var x = 1
console.log(window.hasOwnProperty('x')) // replace `window` with `global` for NodeJS
I am sure I am missing something obvious.