Answers for "how to check if object has the same value"

9

javascript check if objects are equal

const isEqual = (...objects) => objects.every(obj => JSON.stringify(obj) === JSON.stringify(objects[0]));

// Examples
isEqual({ foo: 'bar' }, { foo: 'bar' });    // true
isEqual({ foo: 'bar' }, { bar: 'foo' });    // false
Posted by: Guest on July-03-2020
1

array of objects how to check if property has duplicate

var yourArray = [

{Index: 1, Name: "Farley, Charley", EmployeeCode: "12", PaymentType: "Void", CheckDate: "01/04/2012"},
{Index: 2, Name: "Farley, Charley", EmployeeCode: "12", PaymentType: "Void", CheckDate: "01/04/2012"},
{Index: 3, Name: "Tarley, Charley", EmployeeCode: "12", PaymentType: "Void", CheckDate: "01/04/2012"}
];

   unique = [...new Set(yourArray.map(propYoureChecking => propYoureChecking.Name))];
if (unique.length === 1) {
console.log(unique);
}
Posted by: Guest on May-20-2020

Code answers related to "how to check if object has the same value"

Code answers related to "Javascript"

Browse Popular Code Answers by Language