为什么我的Elseif语句会失败?
Why might my Elseif Statement fail?
我相信我的elseif格式正确,但它是失败的。我尝试用引号(second == equal语句)包装elseif,添加额外的等号。我不知道我还能做什么。
if (window.location.href.includes("?") && window.location.href.includes("year=") )
{
console.log("replace the 4 characters following the equal sign");
}
elseif (window.location.href.includes("?") && window.location.href.includes("year=") == "false")
{
console.log("last condition");
}
else {
console.log("end");
}
在javascript中elseif
不存在。改成else if
其他需要修改的是
window.location.href.includes("year=") == "false"
因为includes
返回一个布尔值,但我认为你知道这一点,这只是一个绝望的尝试。
请尝试!(window.location.href.includes("year="))
,而不是else if
中第二个条件的当前格式。当前的语法有点古怪
try elseif而不是elseif,你已经写错了
相关文章:
- 可以't让我的if语句处理js中的html表单输入
- no-op if 语句会导致 Google 图表失败
- switch语句中的数字比较失败
- Jquery if 语句失败
- HTML if 语句,用于在 CDN 失败时加载本地 JS/CSS
- 如果jquery$.when语句失败,我该如何重新生成它
- if语句条件检查!= "undefined"失败
- 在if语句中获取失败条件
- 使switch语句的部分用例失败,但不是全部
- 为什么我的Elseif语句会失败?
- Javascript“if"语句失败
- “.import"语句(用于在JS中导入Qml类型)失败,出现语法错误
- 为什么我的测试失败,并且lodash方法中的console.log()语句没有记录日志
- 如何修复prepare语句失败的错误:"1"-使用SQLite
- jQuery延迟函数中的语句静默失败
- Javascript if语句失败
- 为什么这个switch语句失败
- Javascript switch 语句失败
- Javascript If语句测试失败
- 在sql中插入语句失败