There are 2 items:
1. obj1 = { bookRetail: 14.99, hierarchyDescription: "GUYS DENIM PANTS [ 0151 ]", isSelected: true, isAvailableInPivot: "Y", style: "VICE NWH NAVY WHITE DC [ M450MBON ]"}
2. obj2 = { bookRetail: 14.99, hierarchyDescription: "GUYS DENIM PANTS [ 0151 ]", isSelected: false, isAvailableInPivot: "Y", style: "VICE NWH NAVY WHITE DC [ M450MBON ]"}
I need to compare these 2 objects without considering the isSelected property, and if they are identical (except for the value of isSelected), I want to set obj2's isSelected to true.
if (JSON.stringify(obj1) === JSON.stringify(obj2)) {
obj2.isSelected = true;
}
Currently, the code above compares both objects including the isSelected property, how can I exclude it from the comparison.