What\'s the best way of checking if an object property in JavaScript is undefined?
I would like to show you something I'm using in order to protect the undefined
variable:
Object.defineProperty(window, 'undefined', {});
This forbids anyone to change the window.undefined
value therefore destroying the code based on that variable. If using "use strict"
, anything trying to change its value will end in error, otherwise it would be silently ignored.