We can say two objects are referentially equal when the pointers of the two objects are the same or when the operators are the same object instance. For example {} === {} is false because it is checking referential equality.
Example:
<script>
var a = 1;
var b = 1;
console.log(a == b); // true
console.log(a === b); // true
var c = 10;
var d = "10";
console.log(c == d); // true
console.log(c === d); // false
const name1 = {
first_name: "sarah",
};
const name2 = {
first_name: "sarah",
};
console.log(name1 == name2); // false
console.log(name1 === name2); // false
console.log(Object.is(name1, name2)); // false
console.log(Object.is(name1, name1)); // true
</script>
Use the share button below if you liked it.
It makes me smile, when I see it.