Created
May 26, 2010 16:18
-
-
Save desaperados/414701 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
// If you need to be able to compare Arrays this is the prototype to do it. Pass an Array you | |
// want to compare and if they are identical the method will return true. If there's a | |
// difference it will return false. The match must be identical so '80' is not the same as 80. | |
Array.prototype.compare = function(testArr) { | |
if (this.length != testArr.length) return false; | |
for (var i = 0; i < testArr.length; i++) { | |
if (this[i].compare) { | |
if (!this[i].compare(testArr[i])) return false; | |
} | |
if (this[i] !== testArr[i]) return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment