Is it possible to generate dynamic variable names in javascript.
I want to be able to generate variables like v1,v2,v3 etc and the numbers 1,2,3 in the above variable names should come dynamically from a loop like
for (i=0;i<=3;i++)
{
//i need a substitute for the below line
var "v"+i=somevalue;
}
Is this possible to do in javascript? I tried
var eval("v"+i)=somevalue; but that didnt work.
Badrinath Chebbi
I want to be able to generate variables like v1,v2,v3 etc and the numbers 1,2,3 in the above variable names should come dynamically from a loop like
for (i=0;i<=3;i++)
{
//i need a substitute for the below line
var "v"+i=somevalue;
}
Is this possible to do in javascript? I tried
var eval("v"+i)=somevalue; but that didnt work.
Badrinath Chebbi