Let's define an object.
const obj = {};
We can check that obj.x is undefined since we can control it like that:
if(typeof obj.x === "undefined") console.log("error");
However, how can I also check if obj.x.y is undefined withouth try, catch block.
if(typeof obj.x.y === "undefined") console.log("error"); // Throws and error
I'm doing and application which gets response from a server and I need check object like error.response.data.error.message is undefined or not.