+ 1

A question in js :)

Would we be able to change the name of a variable later but not when defining it?, if so, how could that be done?, if not, is there any way to get series of variables with the same name but different number(i.e cir1, cir2, cir3,....etc) by defining it only once in function and then call the function at a later time in the code?. thanks guys in advance.

3rd Nov 2017, 1:38 AM
BRKOTTA
BRKOTTA - avatar
2 Answers
+ 7
just define a global array var cir = []; // later codes cir[0] = 1;
3rd Nov 2017, 2:01 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 5
Errrr I am not sure but I think it is possible for eval or exec to do the job :)
3rd Nov 2017, 1:42 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar