If you compare primitive types;
symbol using the equality operator
===, the results is what you would except:
If you compare objects
object, array, function (arrays & functions are a sub-class of object), the result isn't as intuitive:
person2 are both the same type
They 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 objects, 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
Value vs. Reference
When assigning or passing variables of a primitive, a copy of the value is created. When assigning or passing variables of an object, a copy of the reference is created.