·  JavaScript – Syntax – Operators – Comparison

 

- Info:

  - This tutorial shows how to use Comparison Operators in JavsScript: == != < <= > >= instanceof.

  - 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 == right) { window.alert("Left    equals            right."); }

      if (left != right) { window.alert("Left is different from    right."); }

      if (left <  right) { window.alert("Left is smaller then      right."); }

      if (left <= right) { window.alert("Left is smaller or equals right."); }

      if (left >  right) { window.alert("Left is greater then      right."); }

      if (left >= right) { window.alert("Left is greater or equals right."); }

   

    </script>