Christine Joy Fuerte Christine Joy Fuerte - 25 days ago 9
Javascript Question

How to test multiple conditions using not equal?

My code is not working.

I am trying to test if my variable is not equal to any of my conditions.

function text(){
if( input!="BSIT" || input!= "BSBA"|| input!="BSN") { .. }
}

Answer Source

Those || should be &&s.

You want to test if all the conditions are true, not if any of them are true. || will return true as soon as at least one is true.

Also, as @nullpointer pointed out, you shouldn't compare strings via == or !=. See this post for more information.