I'm trying to compare 2 large JavaScript Objects with almost ~200 keys each, the keys are unordered, and have different values for each of the JavaScript Objects, but I only care about the keys if they both have the same set of keys that function would still return true even if they're in different order
I tried the following code but didn't work
var cp = function (nl,en) {
let x= Object.keys(nl);
let y= Object.keys(en);
for (xel in x){
if (!y[xel]){
console.log("missing key en ", xel);
}
}}
Example:
{"key1": "val", "key2": "sdsfaf"}
{"Key2": "val", "key1": "vsdsdsd"}
This should return true
{"key1": "val", "key2": "sdsfaf"}
{"Key2": "val"}
This shouldn't