To test for existence there are two methods.
a. "property" in object
This method checks the prototype chain for existence of the property.
b. object.hasOwnProperty( "property" )
This method does not go up the prototype chain to check existence of the property, it must exist in the object you are calling the method on.
var x; // variable declared in global scope and now exists
"x" in window; // true
window.hasOwnProperty( "x" ); //true
If we were testing using the following expression then it would return false
typeof x !== 'undefined'; // false