title: How to check if key of key of object is undefined
body: <p>Let's define an object.</p>
  <pre><code>const obj = {};
  </code></pre>
  <p>We can check that obj.x is undefined since we can control it like that:</p>
  <pre><code>if(typeof obj.x === &quot;undefined&quot;) console.log(&quot;error&quot;);
  </code></pre>
  <p>However, how can I also check if obj.x.y is undefined withouth try, catch block.</p>
  <pre><code>if(typeof obj.x.y === &quot;undefined&quot;) console.log(&quot;error&quot;); // Throws and error
  </code></pre>
  <p>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.</p>