You have several options:
- Leave it as it is;
- Use associative array / object;
- Use
switch.
The second form is invalid. Javascript Syntax
(2) something like:
var abcOptions = {
"value1" : true,
"value2" : true,
"value3" : true
};
if (abcOptions[abc]) {
...
}
(3):
switch (abc) {
case "value1":
...
break;
case "value2":
...
break;
case "value3":
...
break;
}
Personally, I am not a big fan of this in terms of readability, but it is a sensible approach with a lot of meanings.
I do not necessarily recommend this, but it may be an option in certain circumstances. If you are dealing with only three values, use:
if (abc == "value1" || abc == "value2" || abc == "value3") {
...
}
since it is much more readable.