We are frequently using the following code pattern in our JavaScript code
if (typeof(some_variable) != \'undefined\' && some_variable != null) {
Checking null with normal equality will also return true for undefined.
if (window.variable == null) alert('variable is null or undefined');