CodesJava

Easy learning with example program codes

javascript logical operators tutorial


JavaScript Logical Operators:

JavaScript logical operators are used to perform logical operations on the operands.

JavaScript Logical Operators List:

Operator Description Example
&& Logical AND (20==40 && 20==30) = false
|| Logical OR (20==40 || 20==30) = false
! Logical Not !(20==30) = true

JavaScript Logical Operators Example:

<html>
<head>
<script type="text/javascript">
             var a = true;
            var b = false;
            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);        
      </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