The code is as follows:
if(typeof state.getId().stateId !== "undefined") {
console.log("Not undefined");
} else {
console.log("Undefined");
}
I keep getting this error: TypeError: Cannot read property of stateId
What am I doing wrong?
The issue with this was that state.getId() itself is undefined; and thus getting the property of stateId of state.getId() was the issue. This is not the same as the other question because a) it was not immediately clear that .getId().stateId was a property of undefined.