I came across this problem and thought I would share my solution.
I did a bit of Google-Fu and found a pretty good answer here:
However, I just wanted to know if any duplicates EXISTED. I didn’t care about what they were, so I adapted the solution below:
var checkForDuplicateValues = function(theArray) {
var placeHolder = theArray.length,
comparePlaceHolder;
while(comparePlaceHolder=--placeHolder) {
while(comparePlaceHolder--) {
if(!(theArray[placeHolder]!== theArray[comparePlaceHolder])) {
return true;
}
}
}
return false;
};
I hope this helps! As always leave a comment to provide constructive feedback!