Learn how to compare in Javascript
First we going to check the tools that let me to compare between thing which is called comparsion operaitors
- The == tool: this tools gives me true if I compare between things with the same datatype like numbers if they were equal gives me true or the strings if they are the same it will give me true.
- The != tool: this one gives me true when things are wrong it is call unequal so when I write 1 != 2 it will give me true.
- The === tool:this tool will give me true when the data type and the value are both equal like ‘3’ === ‘3’ is true because they have the same value and datatype.
- The !== tool=this tool gives me true when the datatype and the value are not the same it like unequal but it checks the datatype and the value.
- The <= tool:this allows me to compare between two values if the the value on the left is equal or smaller than the value on the right.
- The >= tool:this allows me compare between two numbers to check if the number on the left is bigger or equal the number on the right.
We could use logical operaitors to compare between coparsion operatiors
We have some logical operaitors to be used and they are (AND,OR,NOT)
- AND: will be represinted by this symbol && and if we compare between two results and one of them is false the AND resulte will be false.
- OR: if we copmare between tow results and onr of them is true the OR resulte will be true.
- NOT: will be represinted by this symbol ! and when we use it the boolean value will change so when we use it when the sentens is true it changes it to false.
other way to write the above logical is like False and anything or true or anything make it stops if it found a falsu in the first one and the second one it stops if there is any true.