Javascript multiple or condition check

前端 未结 4 1687
暗喜
暗喜 2021-01-29 06:44

I have struck with some simple if else checking

var IsCompanyContacttitleUpdate = false;
var ContactStatus = -1;

if ((IsCompanyContacttitleUpdate == false) &am         


        
4条回答
  •  执笔经年
    2021-01-29 07:08

    (ContactStatus == 2 || 3 || 4))

    Here is your problem. You are saying if ContactStatus equals 2, it is true, OR true OR true.

    False = 0, True is anything not 0.

    You need to rewrite that as:

    (ContactStatus == 2 || ContactStatus == 3 || ContactStatus == 4))

    It should work if you change that one thing

提交回复
热议问题