Answers for "this is an object that can compare two other objects and determine whether one is greater than, less than, or equal to the other."

1

check if two objects are equal javascript

function checkObjEqual(obj1,obj2){
for(let key in obj1){
  if(!(key in obj2 )) return false;
  if(obj1[key]!==obj2[key])return false;
}
return true;
}

console.log(checkObjEqual({maroon:'#800000',purple :'#800080'},{purple :'#800080',maroon:'#800000'})) //true
Posted by: Guest on June-23-2021

Code answers related to "this is an object that can compare two other objects and determine whether one is greater than, less than, or equal to the other."

Code answers related to "Javascript"

Browse Popular Code Answers by Language