title: When checking whether !== undefined, I get "Uncaught TypeError: Cannot read property 'propertyName' of undefined"
body: <p>I have encountered this issue several times already. Sometimes it even does nothing, while sometimes it reports this error, seemingly under the same conditions.
  I want to check IF something isn't undefined and in such case I want to perform an action. But when it indeed is undefined, I am SOMETIMES getting an error report that it can't be read, because the property is undefined. I would like to understand the principle of this error that seems to appear under certain conditions. Thank you.
  The code is for example as follows (part of a loop):</p>
  <pre><code>    if (objectName[varName].enemy !== undefined)
      {
          console.log(&quot;enemy found&quot;)
      }
  </code></pre>