Imagine this code:
var obj = {};
obj.x = {};
obj.x.y = {};
if (obj.x.y.z) {
//the test work, I know obj.x.z.z do not exist
}
if (obj.a.b) {
//fail because "cannot read property 'b' of undefined
}
The question is : How I can check the existence of a "leave" (if "b" exist, it must inside "a") without making the test of each its parents before ?