I am checking if a variable matches with any of the following strings:
if (re == "Neliöhinta"||re == "Yhtiövastike"||re == "Vesimaksu"||re == "Hoitovastike"||re == "Rahoitusvastike") {
//do something
}
I was wondering, is there a more elegant/shorter way to write this if condition? Something along the lines of
if(re == ("Neliöhinta"||"Yhtiövastike"||"Vesimaksu"||"Hoitovastike"||"Rahoitusvastike"))
(which doesn't work)
Best I have found so far is
if(/Neliöhinta|Yhtiövastike|Vesimaksu|Hoitovastike|Rahoitusvastike/g.test(field))
Any other ways to do this? Cheers