我在解决这个问题时遇到了问题:
status_ = 'Not Contacted'
if (!(status_ == "Contacted") || (status_ == "Not Contacted") || (status_ == "Not Sure")) {
console.log('didnt match: '+status_)} else{console.log('matched: '+status_)}
返回 - didnt match: Not Contacted
但如果我更改status_ = 'Contacted'
,我会matched: Contacted
我做错了什么?
答案 0 :(得分:3)
NOT仅适用于第一个条件,更改括号
if (!(status_ == "Contacted" || status_ == "Not Contacted" || status_ == "Not Sure")) {...
答案 1 :(得分:1)
由于运营商的优先权和包围,您的专线说:
如果状态不“已联系”,或 “未联系”,或 “不确定”