In php you can do something like:
$this = "that";
$$this = "the other thing"; // can also be written ${$this} = "the other thing";
and what you end up with is a variable name $that with the value "the other thing" just as if you had done:
$that = "the other thing";
Is there something similar in JavaScript? What I need to do is to create a variable that has the name of the value of another variable.
Start Free Trial