|
|
AND OR NOT the logical operatorsLogical operators are mostly consist of AND OR NOT and its combinations. We will discuss more on this with examples for better understanding.
We will use if condition to check and then document.write to print the result. Here is the code.
AND is also written as &&
OR is written as ||
NOT is written as !
NOT EQAL TO !=
var my_var=5; var my_var2="plus2net";
Here is a table with different examples of logical operators
| my_var=="5" && my_var2=="plus2net" | True |
| my_var==="5" && my_var2=="plus2net" | False |
| my_var==5 || my_var2=="plus2net" | True |
| my_var==4 || my_var2=="plus2net" | True |
Found anything wrong or wants to improve the code by adding more features? Post your short comment here or use the Forum
| |
| |
|
|
|
|
|