title: JavaScript "cannot read property "bar" of undefined
body: <p>I've got a function that takes 3 parameters. The problem I have is one of the parameters is a property of a sometimes undefined value of an Object (i.e. it takes in <strong>thing.foo.bar</strong>, and sometimes <strong>thing.foo</strong> is undefined, so it can't access <em>bar</em>). </p>
  
  <p>What's a way around this? Within the function's declaration, I have a conditional checking:
   <code>if (!parameterName)</code>, but the browser (Chrome) is still throwing an error that it can't read the <strong>bar</strong> property of undefined.</p>