当我运行该程序时,控制台给出一个错误,指出“星期日”(和“星期六”,基于用户输入)不存在。我在 if 语句中尝试了多种带括号的组合,但没有任何效果。
var day = prompt("Enter a day of the week.");
console.log("Day is: " + day);
//if user input is equal to Sunday OR user input is equal to Saturday,
if (getText(day) == "Sunday" || getText(day) == "Saturday") {
console.log("It's the weekend!");
} else {
console.log("Can't wait for the weekend to get here.");
}
慕婉清6462132
30秒到达战场
相关分类