I looked at this issue:
How to determine if variable is 'undefined' or 'null'?
But it did not help.
I have the following code:
if (_modeID != 8 && _modeID != 9)
// do something
_modeID
is defined and assigned a value in a separate file all together.
I'm encountering a bug where, for some reason, var _modeID = someIntVal;
is never executed, so when the if
statement above runs there is no _modeID
at all.
I expanded it to be if (_modeID === null || _modeID === undefined || (_modeID != 8 && _modeID != 9)
but this still throws the following error:
ReferenceError - Java Script Error : '_modeID' is undefined
I was hoping that either the first or second condition would evaluate to true in this case but apparently not. Can anyone shed some light as to what I'm doing wrong?
Is var _modeID = undefined; if (_modeID === undefined) ...
not the same as simply if (_modeID === undefined) ...
assuming those two snippets were "complete" files?