codefox
01-21-2003, 06:10 AM
Please take a look at this function:
function test(p1, p2)
{
"a" + p1 + "b" + p2 = 10; // If p1 = 1, p2 = 2, variable a1b2 = 10
}
I want "a" + p1 + "b" + p2 to be considered as a variable. I tried eval("a" + p1 + "b" + p2) = 10, but that didn't work. How can I make a string to represent a variable name?
Thanks.
function test(p1, p2)
{
"a" + p1 + "b" + p2 = 10; // If p1 = 1, p2 = 2, variable a1b2 = 10
}
I want "a" + p1 + "b" + p2 to be considered as a variable. I tried eval("a" + p1 + "b" + p2) = 10, but that didn't work. How can I make a string to represent a variable name?
Thanks.