JSFiddle - React, Tailwind, and code Playground
JavaScript
function Person (firstName, lastName, age) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
}
function Animal (name, type, age) {
this.name = name;
this.type = type;
this.age = age;
}
var family = {};
family.father = new Person ('John', 'Doyle', 33);
family.mother = new Person ('Susan', 'Doyle', 32);
family.pet = new Animal ('Jodie', 'Cat', 2);
function isSameObject(obj1, obj2) {
return Object.getPrototypeOf(obj1) === Object.getPrototypeOf(obj2);
}
console.log(isSameObject(family.father, family.mother));
console.log(isSameObject(family.father, family.pet));