title: What's the simplest approach to check existence of deeply-nested object property in JavaScript?
body: <p>I have to check deeply-nested object property such as <em>YAHOO.Foo.Bar.xyz</em>.</p>
  
  <p>The code I'm currently using is </p>
  
  <pre><code>if (YAHOO &amp;&amp; YAHOO.Foo &amp;&amp; YAHOO.Foo.Bar &amp;&amp; YAHOO.Foo.Bar.xyz) {
      // operate on YAHOO.Foo.Bar.xyz
  }
  </code></pre>
  
  <p>This works, but looks clumsy.</p>
  
  <p>Is there any better way to check such deeply nested property?</p>