javascript if condition with multiple ifs
<p>I'm running a UI component on every page and on one of the pages, there's an extra functionality linked to it. The UI component has a boolean called <code>MyValue</code> and the extra functionality has an object called <code>ExtraObject</code> and one of its properties is a boolean called <code>ExtraBool</code>.</p>

<p>I want to test if MyValue is true AND if ExtraObject.ExtraBool is false, BUT ONLY if ExtraObject exists. That way, if I'm on the pages that don't have ExtraObject, there's no error.</p>

<p>I tried this:</p>

<pre><code>if (MyValue === true &amp;&amp; 
    (typeof ExtraObject === undefined || ExtraObject.ExtraBool === false)) {...}
</code></pre>

<p>How should I rewrite this?</p>

<p>At the moment, I keep getting "ExtraObject is not defined error".</p>

<p>Thanks.</p>
