Created
February 19, 2017 21:14
-
-
Save lusan/5745535e445e06b67ee122d9c921c5cd to your computer and use it in GitHub Desktop.
This file contains 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
/* Module to check if two objects are euqal*/ | |
var isObjectsEqual = function(a, b) { | |
var aProp = Object.getOwnPropertyNames(a); | |
var bProp = Object.getOwnPropertyNames(b); | |
if(aProp.length != bProp.length) { | |
console.log("Objects are not equal"); | |
return false; | |
} | |
for(var i = 0; i < aProp.length; i++) { | |
var propName = aProp[i]; | |
if(a[propName] !== b[propName] ) { | |
console.log("Objects are not equal"); | |
return false; | |
} | |
} | |
console.log("Objects are equal"); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment