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 MyValue and the extra functionality has an object called ExtraObject and one of its properties is a boolean called ExtraBool.
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.
I tried this:
if (MyValue === true &&
(typeof ExtraObject === undefined || ExtraObject.ExtraBool === false)) {...}
How should I rewrite this?
At the moment, I keep getting "ExtraObject is not defined error".
Thanks.
trueandfalse; just refer to the variable or its logical completment (!ExtraObject.ExtraBool)MyValueneeds to betruebut could have alternative values such as1, or'false', where it would be necessary to perform a strict equality comparison.ifstatement...