To start off with comparisons it might be a good idea to start out with a few simple assignment examples. Expressions that make used of equality and identity operators will often be used to create a boolean value that will be used in a conditional statement. However they are also often used in expressions where some kind of value will end up being assigned to a variable also.
Things will just get a little involved when it comes to using assignment with more complex expressions that involve comparisons, and maybe a conditional operator.
Simple enough for the most part however there are some things to be ware of, and there is also another operator === known as the identity operator. So be sure to read on if this is a subject that you still find a little confusing.
The main difference between == and === is that == preforms type conversion. In the event that both operands that are used in the operation are not of the same type then type conversion is used to check if they equal each other when converted.
When comparing two objects the result is true when both operands are references to the same object. However any comparison of two objects that are different objects in memory will also result in false, even if they have the same set of values.
So when comparing objects the only thing of interest is if they are both the same object or not. If you want to find out if two objects have the same set of values or not you will want to loop over the contents, and compare each key. If you want to find out if they are both objects of the same class you could try the constructor property that would work in most cases.
Same as with numbers and strings if a boolean is compared to a non boolean value type conversion is preformed. The resulting boolean value depends on the data type and the value of the type.