是否可以编写如下 if 语句:
if(a === 0 && (b === 0 || c === 0)){
if(b === 0 && c === 0){
//a, b, and c are equal to 0
}
else if(b === 0){
//only a and b are equal to 0
}
else {
//only a and c are equal to 0
}
}
else {
//a doesn't equal 0, but b or c could so we test those
}
它似乎在我以类似方式编写的代码中不起作用......也许我写错了?这在我的脑海中是有道理的。如何构建我的代码以避免这样的混淆?