In Javascript, I'm used to having access to variables in a known namespace โdynamicallyโ (correct me if I use the wrong word here) using an operator []. For example (from the global namespace):
var a = 1;
window['a'];
Or from an object type namespace:
var a = { b: 1 };
a['b']; # => 1
And I am familiar with the basics of the definition this:
var a = function(){ return this['c']; };
var b = { c: 1 };
a.apply(b);
But inside the function itself, how do I access the local variables that I just created (or redefined) using var?
Namely, I want the next function call to return 1, but without calling a:
function(){
var a = 1;
return a;
}
window['a'], a , this['a'], this , .
, , , , , , a .