# Equal to NOT equal to Less than & greater than

In our JavaScript code we will use various comparison and logical operators to identify various conditions and accordingly execute different codes. It can be a simple comparison or a complex combination of logical operators and comparisons. These comparisons are mainly checking for equal to or NOT equal to status and using AND OR NOT logical operators within our JavaScript code.

We can understand it better by using some examples. To check the status we will be using document.write to print the result by saying “True” or “False” . We will be using one if condition for this.

## Comparison operator

``````
var my_var = 5;

if(my_var=="5"){document.write("True")}
else{document.write("False")}
// output False
``````
You can see the above out put will be False
This way we can check different comparison conditions. Note that when we use == we are matching only value not type but when we use === we are comparing both type and value. Here is a short table to explain various conditions and its outputs for different if conditions. Note that we have changed the if condition checking only and in all the cases we have considered the value of my_var=5
``var my_var=5;``
 my_var==5 True my_var=="5" True my_var==="5" False my_var=="4" False my_var==4 False
You can see my_var==="5" has given us output False, because we are checking value and type both. But in case of my_var=="5" it is True as we y compare value only not type.

## Less Than < , Greater Than >

We will continue with our variable like this my_var=5 , here is the table.
``var my_var=5;``
 Less than Equal to my_var<=5 True Greater than equal to my_var>=5 True Not Equal To my_var!=5 False plus2net.com For Loop with break statement Do While Loop with break statement in JavaScript Switch statement If Else Try Catch to handle run time errors in different browsers Logical operators AND OR NOT Comparison operators Equal to, Less than, greater than JavaScript code inside html page & its structure throw to manage error message and program control Local & Global variables in JavaScript and uses inside functions Checking type of variable by using typeof() Comments adding inside JavaScript code Sample codes for beginners Functions and variables

Post your comments , suggestion , error , requirements etc here .