let a = {name: undefined,age: 13}
let b = {name1: undefined,age: 13}
function shallowEqual(a,b) {
const keysA = Object.keys(a)
const keysB = Object.keys(b)
if(keysA.length !== keysB.length){
return false
}
for(let i = 0; i < keysA.length; i++){
if(!b.hasOwnProperty(keysA[i]) || !Object.is(a[keysA[i]],b[keysA[i]])){
return false
}
}
return true
}
console.log(shallowEqual(a,b))