Table Of Contents
string, number, boolean using the equality operator
===, the results is what you would except:
However, if you compare structural types
object, array, function, the result isn't as intuitive:
Take a look at
They are both the same type
object & have the same properties & values.
It would makes sense if the equality operator returned
true when comparing them, but it doesn't.
This is because when you compare structural types, the operator is testing reference equality, not value equality.
Testing whether they are the same instance, not whether they are the same value.
person2 may have the same value, but they are 2 different object instances (if I change a property on 1, the other will remain the same).
Thus, when compared using the equality operator, it returns