title: hasDeepProperty in Node JS & JavaScript
body: <p>After spending many hours today searching for a specific condition functionality and testing my modified finds. I thought I share my coding snippets and knowledge here. I'm not too good at answering other questions so I thought it would do to post my finds and hope it would benefit others. Since this site has been really helpful with my projects.</p>
  
  <p>Anyway. At some point when you get to a stage scripting more complicated scripts. You'll most likely bump into a problem were you'll need to check deep in objects if a certain property exists. This has occurred mostly with JSON API from my experience.</p>
  
  <p><strong>Example Issue</strong></p>
  
  <pre><code>if (someObject &amp;&amp; someObject.nextObject &amp;&amp; someObject.nextObject.andAnother) {
      // do something if all of this exists
  }
  </code></pre>
  
  <p>Trying to check the deepest property, when one property in the middle doesn't exist, will throw a reference error.</p>
  
  <pre><code>ReferenceError: something is not defined
  </code></pre>
  
  <p>At some point these can get really long and messy to work with. Which is pretty much silly.</p>
  
  <p><strong>Trying to Tidy Like That Makes <a href="http://jslint.com" rel="nofollow noreferrer">JSLint</a> Complain &amp; Can Be Harder for Another Scripter to Read</strong></p>
  
  <p><a href="http://jslint.com" rel="nofollow noreferrer">JSLint</a> doesn't like when code ends up like this when scripters try to reduce the amount of characters on one line. Even I find it more difficult to read with other nested conditions together:</p>
  
  <pre><code>if (someObject
      &amp;&amp; someObject.nextObject
      &amp;&amp; someObject.nextObject.andAnother) {
      // do something if all of this exists
  }
  </code></pre>