CodesJava

Easy learning with example program codes

javascript comparison operators tutorial


JavaScript Comparison Operators:

JavaScript comparison operators are used to compare the two operands.

JavaScript Comparison Operators List:

Operator Description Example
== Is equal to 10==30 = false
=== Identical (equal and of same type) 10==40 = false
!= Not equal to 20!=20 = true
!== Not Identical 20!==20 = false
> Greater than 30>10 = true
>= Greater than or equal to 40>=10 = true
< Less than 25<10 = false
<= Less than or equal to 25<=10 = false

JavaScript Comparison Operators Example:

<html>
<head>
<script type="text/javascript">
            var a = 10;
            var b = 20;
            var linebreak = "<br />";
 
            document.write("(a == b) => ");
            result = (a == b);
            document.write(result);
            document.write(linebreak);
 
            document.write("(a < b) => ");
            result = (a < b);
            document.write(result);
            document.write(linebreak);
 
            document.write("(a > b) => ");
            result = (a > b);
            document.write(result);
            document.write(linebreak);
 
            document.write("(a != b) => ");
            result = (a != b);
            document.write(result);
            document.write(linebreak);
 
            document.write("(a >= b) => ");
            result = (a >= b);
            document.write(result);
            document.write(linebreak);
 
            document.write("(a <= b) => ");
            result = (a <= b);
            document.write(result);
            document.write(linebreak);
      </script>
</head>
   <body>
   </body>
</html>

Try it:

JS Bin on jsbin.com
 



Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki