You can compare two objects in Javascript to make sure there refer to the same instance
function Person(name){ this.name=name } var p1= new Person("John") var p2= new Person("John") console.log("Are these equal "+p1===p1)
You can see following output in browser console
>Are these equal? false
In this example, I am creating two objects with same property but they are not equal.