title: Possible to create a global scope closure in javascript?
body: <p>Goal is to be able to allow a global variable (such as <code>currentAccount</code>) to refer to multiple values at the same time based on the execution context.</p>
  
  <pre><code>var context = new Context();
  context.currentAccount = "mine";
  context.execute(function() {
     // any code in or called by this function 
     // needs access to the `currentAccount` variable
  
     // for example
     var model = new Model();
     model.doSomething(); // model needs to be able to refer to `currentAccount`
  });
  
  context = new Context();
  context.currentAccount = "yours";
  context.execute(function() {
     ...
     model.doSomething(); // `currentAccount` =&gt; "yours"
  });
  </code></pre>