Reference a Javascript variable by a text alias
javascript
Solution
You could go right on and create an Object reflect and assign properties to it.
var reflect = new Object();
reflect.x = 2;
var y = reflect["x"];
Fiddle: http://jsfiddle.net/wE4Ft/
Problem
Is it possible to reference a JavaScript variable by a text alias? For example: ``` var x = 2; var y = convertToVariableRef("x"); ``` After calling the above function: "`y` would be the same reference as `x` and not just simply copying the value of `x` into `y`".