I'd like to do something like this:
function someFunction(expression){
eval(expression) = 1234;
}
Or in other words, to pass a certain field name as an argument and then set a value to this field. How can I do that?
I'd like to do something like this:
function someFunction(expression){
eval(expression) = 1234;
}
Or in other words, to pass a certain field name as an argument and then set a value to this field. How can I do that?
If you want to assign a value to a new variable with a variable name, in the global scope, you can just do this:
function someFunction(expression){
window[expression] = 1234;
}
There is really no good excuse to use evil()