·  JavaScript – Syntax – Operators – Logical

 

- Info:

  - This tutorial shows how to use Conditional Operators in JavaScript.: && || !.

  - This tutorial is based on http://www.eecs.umich.edu/~bartlett/jsops.html.

 

- Example:

  - Create D\Temp\JavaScript\Test.html

 

    Test.html

    <script type="text/javascript" language="javascript">

      

      left  = 65;

      right = 70;      

   

      if ( left> 50 && right==70 ) { window.alert("left >50 AND right==70"  ); }

      if ( left!=50 || right> 90 ) { window.alert("left!=50 OR  right> 90"  ); }

      if (          !  (left==80)) { window.alert("left is  NOT equal to 80"); }

   

    </script>