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.
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
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.