I will give a simplified version of my two objects with nested objects inside them:
Object1:
{firstname: 'John', lastname: 'Cena', privateInfo: {privateProperty1: false, privateProperty2: true}}
Object2:
{firstname: 'John', middlename: 'Felix', lastname: 'Pina', privateInfo: {privateProperty1: true, privateProperty2: true} }
After comparing Object1 to Object2, I want to store all the different properties that Object2 has in a new object. In my case this will be:
let Object3 = {middlename: 'Felix', lastname: 'Pina', privateInfo: {privateProperty1: true}}
What would be the best and most efficient way to compare all properties of those objects (including nested ones and missing ones)?
In my case the properties of an object can reach up to 30-40. Efficiency is quite important here.