I need to compare complex objects. i.e:
const obj1 = {
data1: [{ nestedKeyLevel1: ['text1'] }],
data2: [{ nestedKeyLevel1: [{ nestedKeyLevel2: ['text2'] }] }]
};
const obj2 =
{
data1: [{ differentKeyName: ['text1'] }],
data2: [{ nestedKeyLevel1: [{ nestedKeyLevel2: ['text2'] }] }]
}
;
I need to compare the object and get a boolean value of either their key names (not values are equal.
Meaning in the example above, the result will be false as the key name in obj1.data1[0]
is different than the key name in obj2.data1[0].
How can I do it?