私はJavascriptの完全な初心者であり、ブール式の可能なすべての組み合わせを試した後、次のコードが残ります。次のJSブール論理が、effectiveDateSelected=trueおよびthroughDateSelected=false以外のすべてで失敗するのはなぜですか。
// initialisation
var effectiveDateSelected = new Boolean(false);
var throughDateSelected = new Boolean(false);
// values read in from web page
effectiveDateSelected = ...
throughDateSelected = ...
// the logical expression
if ((effectiveDateSelected) && !(throughDateSelected)) {
reportNum = 1;
alert("1 reportNum=" + reportNum);
}
if (!(effectedDateSelected) && (throughDateSelected)) {
reportNum = 2;
alert("2 reportNum=" + reportNum);
}
if (((effectedDateSelected) && (throughDateSelected)) ||
(!(effectedDateSelected) && !(throughDateSelected))) {
reportNum = 3;
alert("3 reportNum=" + reportNum);
}