DEV Community

Anjali Gurjar
Anjali Gurjar

Posted on

JS Interview Question

const record=[{
id:1,
name:"Anjali",
age:12,
city:"bhopal",
salary:200

},

{
id:1,
name:"Anju",
age:18,
city:"vidisha",
salary:200

}]

const diff=[]
const [firstrecord,secordrecords]=record

for(let key in firstrecord){
if(firstrecord[key]!==secordrecords[key]){
diff.push(firstrecord[key],secordrecords[key])
}
}

console.log(diff)

Top comments (0)