how to create variable name dynamically?
eg: if (test==1)
var test1=1
if (test==2)
var test2=2
here test1 and test2 should create dynamically.
i tried
var “test”+1.
But throws error.
Any idea?
how to create variable name dynamically?
eg: if (test==1)
var test1=1
if (test==2)
var test2=2
here test1 and test2 should create dynamically.
i tried
var “test”+1.
But throws error.
Any idea?
Have a look at the following jsFiddle on how to accomplish this.
thank you very much for your help.it worked.