JavaScript Tutorial ✦
Compare Two Objects
Function to determine if two objects have the same properties and values.
function objectsEqual(obj1, obj2) {
return JSON.stringify(obj1) === JSON.stringify(obj2);
}
console.log(objectsEqual({ a: 1 }, { a: 1 })); // true