Logical operators are used to perform Boolean operations on operands. Logical operators are and (&&), or ( || ) , not (!) . The value returned after using a logical operator is Boolean value true or false. Logical operators are connectors of expressions also. | ||||||||
|
||||||||
Example | ||||||||
<html>
<head> </head> <body> <script> var a=9 var b=8 var c=25 document.write(“<br> a is : “+a) document.write(“<br> a is : “+b) document.write(“<br> a is : “+c) document.write(“<br>is a greater than b and greater c also ? : “+(a>b && a>c)) document.write(“<br>is a greater than b or greater c ? : “+(a>b || a>c)) document.write(“<br>not c is greater than a ? : “+!(c>a)) </script> </body> </html> |
||||||||
Output: | ||||||||
a is : 9 a is : 8 a is : 25 is a greater than b and greater c also ? : false is a greater than b or greater c ? : true not c is greater than a ? : false |