这个逻辑陈述的反面是什么

what is the opposite of this logical statement

我只想检查 else 条件。有没有办法可以简化下面的代码?

      if (_endCurrentGoal && _startCurrentGoal && _startCurrentGoal === _startEffectiveDate && _endCurrentGoal === _endEffectiveDate) { //no statement );
       } 
       else {
          console.log("check for this code only");
       }

下面的代码是否正确?有没有办法简化它?

       if(!(_endCurrentGoal && _startCurrentGoal && _startCurrentGoal === _startEffectiveDate && _endCurrentGoal === _endEffectiveDate) {
          console.log("check for this code only");
       }

您可以使用 De Morgan's Law 通过 && 分发 !

看起来像这样:

   if(!_endCurrentGoal || !_startCurrentGoal || _startCurrentGoal !== _startEffectiveDate || _endCurrentGoal !== _endEffectiveDate) {
      console.log("check for this code only");
   }