I've got a bit of a problem here. I've got the following code declaring two variables:
var anawesomevariable = "hello world";
var variabletwo = "anawesomevariable";
As you can see, the second variable's contents are the same as the name of the first variable. My problem: I want to change the first variable using the contents of variabletwo
. So in other words, I want to say "Hey Javascript, change the contents of the variable whose name is in variabletwo
". Is there any way to do this in Javascript?
P.S. I havn't really explained that clearly, but you get my point (I hope)