title: Javascript global variables and properties in nodejs - global properties sometimes deleted?
body: <p>Why does the following print "undefined" when run in node (0.10.36)?</p>
  
  <pre><code>test = 'a global property';
  var test = 'a variable';
  console.log(global.test);
  </code></pre>
  
  <p>If the variable declaration is omitted (remove line 2), 'a global property' is logged as expected.</p>
  
  <p>If the global property is set explicitly on the global object via <code>global.test = 'a global property'</code>, then it is also logged as expected.  I thought that these two statements were equivalent:</p>
  
  <pre><code>test = 'foo';
  global.test = 'foo';
  </code></pre>
  
  <p>It almost seems like there is some situation where a variable declaration with the same name as an implicitly created global property causes that property to be deleted?</p>
  
  <p>(I understand use of globals is generally bad practice, I am trying to understand how nodejs differs from various browsers in its handling of code relating to global property and variable declaration).</p>