In the js code I have
var a1 = "text in a1";
var right_text = a1;
a1
is the variable where this text is written.
the value of right_text
will change.
I need have more variables like a1
because each of them will do something else.
switch (right_text) {
case a1:
...
case a2:
...
case a3:
...
I would like it to increase value of right_text
to a2
after first click on the button and to a3
after another click and so on.
So I want to get the variable a1
as a string
, add one and get a2
.
But now I need to somehow detect the current value of right_text
, ie a1
, not the content written in a1
.
I tried
right_text.toString ();
But that will return the mentioned content a1
. It could be done somehow so that I can get value of right_text
(a1
in this case) and convert it as string
?
Thank you
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…