I have two objects to compare. I want to find the key and its value which is different in the second object. Which should return only the different key and its value in an object.
const obj1={name:"abc",age:21,place:"xyz"}
const obj2={name:"pqr",age:21}
So, here I want to return {name:"pqr"}
as here the name value is different from the first object.
And I have tried ,
const returnObject = Object.assign({}, findOwner, data);
and
const returnObject = { ...findOwner, ...data };
but these are returning not exactly what I want.
The solutions is,
This function will return the changes which are traced in two objects