In JavaScript, is there an easier way to check if a property of a property exists?
<p>Is there an easy way to natively determine if a deep property exists within an object in JavaScript?  For example, I need to access a property like this:</p>

<pre><code>var myVal = appData.foo.bar.setting;
</code></pre>

<p>But there is a chance that either foo, foo.bar, or foo.bar.setting has not been defined yet. In Groovy, we can do something like this:</p>

<pre><code>def myVal = appData?.foo?.bar?.setting
</code></pre>

<p>Is there a similar way to do this in JavaScript, without having to write a custom function or nested if statements?  I've found <a href="http://stackoverflow.com/questions/6571551/shorthand-function-for-checking-whether-a-property-exists">this answer</a> to be useful, but was hoping there was a more elegant and less custom way.</p>
