Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
450 B
2
Indexable
Never
function compareObject(ob1,ob2){
  const keyob1=Object.keys(ob1)
  const keyob2=Object.keys(ob2)
  for(let i=0;i<keyob1.length;i++){
    if(keyob1[i]!==keyob2[i]){
      return false
    }
  }
  return true
}
const object1={
  name: "Benny",
  phone: "3325558745",
  email: "benny@edabit.com"
  }
const object2={
  name: "Jason",
  phone: "9853759720",
  email: "jason@edabit.com"
  }
console.log(compareObject(object1,object2))