Dave Partner

Javascript tutorial - 12 - Logical Operators

  • 0 Replies
  • 154 Views

0 Members and 1 Guest are viewing this topic.

*

Offline Dave Partner

  • Administrator
  • Full Member
  • *****
  • 109
    • View Profile
Javascript tutorial - 12 - Logical Operators
« on: November 08, 2016, 04:26:57 AM »
&t=23s


<!DOCTYPE html>
<html>
<head>
   
</head>


<body>
   <script type="text/javascript">
      /*
      More operators : logical operators
         && (Logical AND) (multiplication)
         || (Logical OR) (addition)
         ! (Logical NOT) (negation)
      */
      
      /*
      //logical and
      var number1 = true; //1
      var number2 = false; //0
      var result = (number1 && number2); //0
      document.write(result);
      
      var var1 = 10;
      var var2 = 20;
      //document.write(result);
      
      if((var1 > 5) && (var2 > 15) && ((var1 + var2) == 30)){
         document.write("You are greater");
      }*/
       
       /*
       //logical OR
         var var1 = 10;
      var var2 = 20;
      //document.write(result);
      
      if((var1 < 5) || (var2 > 15)){
         document.write("You are greater");
      }
      */
      
      var number1 = true; //1
      var number2 = false; //0
      var result = !(number1 && number2); //0
      document.write(result);
      
      
   </script>
</body>
</html>