Considering the following code:
var a = {};
if (a.b.c !== undefined) {
console.log("definido!");
} else {
console.log("indefinido!");
}
Is there any way to check each property without having to test one by one?
What I want is the result of a if
similar to the following but simplified:
var a = {};
if (a !== undefined && a.b !== undefined && a.b.c !== undefined) {
console.log("definido!");
} else {
console.log("indefinido!");
}