title: How can I dynamically access a global variable in Node?
body: <p>In browser-based JavaScript, you can do something like this:</p>
  
  <pre><code>var foo = "foo";
  
  (function() {
      var foo = "bar";
  
      console.log(foo);
      // =&gt; "bar"
  
      console.log(window["foo"]);
      // =&gt; "foo"
  })();
  </code></pre>
  
  <p>Is there any way to do something similar in Node, which lacks a <code>window</code> object?</p>