DEV Community

Discussion on: Deep Equality checking of Objects in Vanilla JavaScript 👨‍👦

Collapse
 
ansmtz profile image
ansmtz

Doesn't work with methods :(

Collapse
 
sanderdebr profile image
sanderdebr

You are right! I've updated the code to also check for methods:

if (typeof a[key] === 'function' || typeof b[key] === 'function') {
if (a[key].toString() != b[key].toString()) return false;
}

Thankyou!