Created
September 2, 2022 09:27
-
-
Save sakshstore/f41a84a0e58c5e7aa655570bad0ab44b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compareObjects = (obj1, obj2) => { | |
const c = Object.keys(obj1), | |
n = Object.keys(obj2); | |
return c.length === n.length && c.every((c) => obj1[c] === obj2[c]); | |
}; | |
// Usage | |
compareObjects({ a: 1, b: 2 }, { a: 1, b: 2 }); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment