take a look at this code. i missed type "Object" instead of "object" i found out an interesting error
`function deepEqual(a, b) {
if (a === b) return true;
if (a == null || typeof a != "Object" || b == null || typeof b != "Object") {
return false;
}
let keysA = Object.keys(a),
keysB = Object.keys(b);
if (keysA.length != keysB.length) return false;
for (let key of keysA) {
if (!keysB.includes(key) || !deepEqual(a[key], b[key])) {
return false;
}
}
return true;
};
let obj = { here: { is: "an" }, object: 2 };
console.log(
deepEqual(
{ here: { is: "an" }, object: 2 },
{ here: { is: "an" }, object: 2 }
)
);
// => false
console.log(deepEqual(obj, obj));
// => true
`
as you can see i put the raw object the function return false but if i put both of them it in variables they return true
take a look at this code. i missed type "Object" instead of "object" i found out an interesting error
`function deepEqual(a, b) { if (a === b) return true; if (a == null || typeof a != "Object" || b == null || typeof b != "Object") { return false; } let keysA = Object.keys(a), keysB = Object.keys(b);
if (keysA.length != keysB.length) return false;
for (let key of keysA) { if (!keysB.includes(key) || !deepEqual(a[key], b[key])) { return false; } }
return true; }; let obj = { here: { is: "an" }, object: 2 }; console.log( deepEqual( { here: { is: "an" }, object: 2 }, { here: { is: "an" }, object: 2 } ) ); // => false console.log(deepEqual(obj, obj)); // => true ` as you can see i put the raw object the function return false but if i put both of them it in variables they return true