Possible Duplicate:
How to nest OR statements in JavaScript?
Is there a way to do this:
if( variable1 == (variable2 || variable3 || ...) )
I need to check if variable1 is equal to either variable2 variable3 4 5...
I can't directly do this:
if( (variable1 == variable2) || (variable1 == variable3) || ...) )
because I don't know exactly how many variable2 3 4 5... I have
btw variable2 3 4 5... are the elements of my array. I tried this but nothings happen.
if( variable1 == (variable2 || variable3 || ...) )
update: here's the snippet
let say strskill equal to:
abc|def|ghi|jkl|
.
var myskl = document.getElementById('strskill').value.split("|");
for(var q=0; q<(myskl.length); q++)
{
var r = r + "myskl[q], ";
var s = r + "myskl[q]";
}
if(s.indexOf(myArray[i]) > -1)
{
continue;
}
I tried your suggestion, but still not working!