what is the best aproach to check if a "deep" structure is undefined?
For example I have some check like this:
if (json.error.message != undefined) {
console.log(json.error.message);
}
The problem here is, that if json.error is already undefined this will crash. So I would need to write something like:
if (json.error != undefined && json.error.message != undefined) {
console.log(json.error.message);
}
But this could not be the best aproach or? When I would have even "deeper" structures.