title: JavaScript Object Accessors returns Undefined during object property checking
body: <p>I've created a module scaffolding for my node environments.</p>
  <pre><code>const environments = {}
  
  environments.staging = {
      port: 3000,
      envName: 'staging'
  }
  
  environments.production = {
      port: 5000,
      envName: 'production'
  }
  </code></pre>
  <p>and when I check every time the current environment returns the current <code>process.env.NODE_ENV</code> value</p>
  <pre><code>const currentEnvironment = typeof(process.env.NODE_ENV) === 'string' ? process.env.NODE_ENV : 'staging'
  console.log(currentEnvironment) //staging or production
  </code></pre>
  <p>But, when I'm checking it with my environments objects It always returns <code>undefined</code></p>
  <pre><code>const environmentToExport = typeof environments[currentEnvironment] === &quot;object&quot; ? environments[currentEnvironment] : environments.staging
  console.log(environments[currentEnvironment]) // here returns undefined.
  </code></pre>
  <p><strong>what is the fault in my code?</strong></p>