此条件运算符给出了左手赋值错误,我似乎无法弄清原因。
else if (schedule == undefined && season != "winter" && typeb = false) {
console.log("It works");
}
答案 0 :(得分:1)
一个等号是赋值。您需要typeb == false
或typeb === false
else if (schedule == undefined && season != "winter" && typeb == false) {
console.log("It works")
}
答案 1 :(得分:0)
您在条件中使用=
(赋值运算符)-将其更改为==
(比较运算符):
else if (schedule == undefined && season != "winter" && typeb == false) {...}
或仅使用!
:
else if (schedule == undefined && season != "winter" && !typeb) {...}