I was wondering if it is possible to access a variable (i.e. get the value of that variable) by using the name of that variable. An example would be:
function myObject(){
var x = 1;
this.get = function(varName){return eval(varName);};
}
var test = new myObject();
test.get("x");
I know this is possible with eval, but I was wondering if the same could be done without the use of eval, like i.e. with Function. (The use of eval is not allowed in the framework I'm using.)