// Returns true/false when the values of two objects are exactly equal
function isObjectValueEqual (a, b) {   
  // Take the attribute names of objects A and B
  var aProps = Object.getOwnPropertyNames(a);
  var bProps = Object.getOwnPropertyNames(b);
  // Determine whether the length of the attribute name is consistent
  if(aProps.length ! = bProps.length) {return false;
  }
  // Loop through the attribute name and check whether the attribute values are consistent
  for (var i = 0; i < aProps.length; i++) {
    var propName = aProps[i];
    if(a[propName] ! == b[propName]) {return false; }}return true;
}
Copy the code