title: In Javascript, why does a child key of an undefined object return with error instead of just undefined?
body: <p>Say that I have an object that is currently <code>undefined</code></p>
  
  <p><code>myObject.property1</code></p>
  
  <p>It would make sense that any children key off of something that's undefined should also evaluate as undefined, right?</p>
  
  <p><code>myObject.property1.description</code></p>
  
  <p>But when I go into the JS console I do:</p>
  
  <p><code>myObject.property1</code></p>
  
  <p><code>undefined</code></p>
  
  <p><code>myObject.property1.description</code></p>
  
  <p><code>TypeError: Cannot read property 'description' of undefined</code></p>
  
  <p>Where this gets messy is if I'm doing a conditional:</p>
  
  <pre><code>if(myObject.property1.description){
    console.log("it is defined!");
  }else{
    console.log("it is not defined!");
  }
  </code></pre>
  
  <p>I would expect it to console log <code>it is not defined!</code> but instead I get the error and the conditional just flat-out fails. I want it to evaluate as undefined though. </p>
  
  <ol>
  <li>Why doesn't it return <code>undefined</code> as well?</li>
  <li>I want the conditional to check for the <code>existence</code> of the value. How do I do this?</li>
  </ol>