如果满足条件,我想跳过块语句。const isJQuery = apps[key].technology === "jQuery";//如果检查以下条件,我想跳过isJQuery。 if (!apps[key].aemSchema ) { additionalErrors.push( `There is no schema defined for ${key} (aka ${apps[key]})!` ); } else if (!schemas[apps[key].aemSchema] ) { additionalErrors.push( `No schema ${key} (aka ${ apps[key] })! Double check that it exists in name ${ apps[key].aemSchema }, and that the version included here is right. `found apps was `, apps ); }任何帮助都会有所帮助。我试过if (!apps[key].aemSchema || !isJQuery) { //code }但这将始终检查第一个条件。
1 回答

绝地无双
TA贡献1946条经验 获得超4个赞
正如我在上面的评论中所说,if语句中的表达式按照您列出它们的顺序进行检查。如果使用&&第一个false条件将退出if. 如果使用||第一个true条件将退出if. 在您的情况下,我可能只是将if条件检查放在第一级:
if (!isJquery) {
// Other if/else statements inside
}
添加回答
举报
0/150
提交
取消