Hello it is possible to access the value of a JavaScript variable by name? Example:
var MyVariable = "Value of variable";
function readValue(name) {
....
}
alert(readValue("MyVariable"));
Is this possible, so that the output is “Value of variable”? If yes, how do I write this function?
Thanks
Global variables are defined on the
windowobject, so you can use: