I am reading some data from the database which are numbers.
What I need to do is to assign a name to each number …
something like:
get the variable: ... thevar = '1';
If thevar = 1 then myname = 'name1';
else
If thevar = 2 then myname = 'name2';
How can I do this with javascript?
Sorry, I don’t think I’ve explained it properly…what I need if the syntax on how I would do this the above with javascript.
Hope it now makes more sense.
How about
myname = 'name' + myvariable;Assuming you want the syntax of w.e you have posted,