I have an object that returns properties that are either defined
or undefined
.
I wish to handle these undefined
properties but I keep getting an error of undefined. The following two code snippets below are what I have tried so far:
if (typeof choice.Location == "undefined") {
}
and
if (choice.Location == undefined) {
}
Edit:
To clarify, if I do something like this.
if (typeof choice == "undefined") {
}
else if (choice.Location) {
//do something
}
I get the same error.