title: Why won't my global variable update after this function is called in Node.js?
body: <p>My global variable isn't changing after the function is called in Node.js when I run the application in Sublime Text 3. When I run it in bash, it changes as expected. When I replace "global.firstname = 'David'" with "window.firstname = 'David'" and run it in chrome's console, it changes as expected.</p>
  
  <pre><code>var firstname = 'Simon';
  
  var addSurname = function(){
  
      var firstname = 'Gene';
      var surname = 'Holmes';
      var fullname = firstname + ' ' + surname;
      global.firstname = 'David';
      console.log(fullname);
  };
  
  addSurname();
  console.log(firstname);
  
  // Gene Holmes
  // Simon
  </code></pre>
  
  <p>Ultimately, I want it to output</p>
  
  <pre><code>// Gene Holmes
  // David
  </code></pre>
  
  <p>Why isn't the "global.firstname='David'" statement updating my global variable with the Node.js build in Sublime Text 3?</p>