Let's say we have a window object that looks like window.someObject.someProperty.subProperty and we have an if condition where we check if subProperty === "foo". 
In order to avoid a cannot read property xxx of undefined I would have to write something like
if (window.someObject && window.someObject.someProperty &&  window.someObject.someProperty.subProperty === "foo") {
      // do something
}
Now imagine the object has more properties, it would be very long to check for all of them.
So my question is whether or not there is a faster way to perform that check without having to write all the sequence of properties.
 
     
     
    