title: Javascript Undefined Check Shorthand
body: <p>I am looking for a way to default a javascript value if something in an object with 3+ depth is undefined.  For instance, something like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>var finalData = {};
  const data = {};
  finalData.transactions = data.b.transactions || [];
  </code></pre>
  
  <p>instead of:</p>
  
  <pre class="lang-js prettyprint-override"><code>var finalData = {};
  const data = {};
  if (data.b)
      finalData.transactions = data.b.transactions || [];
  else
      finalData.transactions = [];
  </code></pre>
  
  <p>The problem with the first line is it will fail with an undefined access issue if data does not have a child named b.</p>