title: JavaScript: Reference a functions local scope as an object
body: <p>When I call a function, a local scope is erected for that call. Is there any way to directly reference that scope as an object? Just like window is a reference for the global scope object.</p>
  
  <p>Example:</p>
  
  <pre><code>function test(foo){
      var bar=1
      //Now, can I access the object containing foo, bar, arguments and anything
      //else within the local scope like this:
      magicIdentifier.bar
  }
  </code></pre>
  
  <p>Alternately, does anyone have a complete list of what is in the local scope on top of custom variables?</p>
  
  <p>Background: I'm trying to get down to a way of completely shifting to global scope from within a function call, the with statement is a joke, call works a little better, but it still breaks for anything declared in function scope but not in global scope, therefore I would declare these few cases in global scope, but that requires me to know what they are. The IE function execScript makes a complete shift, but that only solves the problem for IE.</p>
  
  <p>Note: To anyone loading JavaScript dynamically, <code>setTimeout(code,1)</code> is a simple effective hack to achieve global scope, but it will not execute immediately.</p>