totalled9
12-30-2007, 01:47 AM
Hi all!
I've just started with programming in javascript, and I've run into a problem that I haven't been able to find an answer to in any books or on the web. I was hoping someone could help.
I've been trying to call a variable so that I can set it equal to something by using another variable's value as part of the name. Something like this:
var test1 = "blah";
var i = 1;
test+i = "It Worked";
Now if this worked the way that I wanted, then test1 would now contain the phrase "It Worked." Does anyone know what I can do to make this work? I've tried reading up on this and I cannot find a way to do this. I hope someone can help.
Thanks!
I've just started with programming in javascript, and I've run into a problem that I haven't been able to find an answer to in any books or on the web. I was hoping someone could help.
I've been trying to call a variable so that I can set it equal to something by using another variable's value as part of the name. Something like this:
var test1 = "blah";
var i = 1;
test+i = "It Worked";
Now if this worked the way that I wanted, then test1 would now contain the phrase "It Worked." Does anyone know what I can do to make this work? I've tried reading up on this and I cannot find a way to do this. I hope someone can help.
Thanks!