Nodejs Array Repeat Check isRepeat()

Here you can find the source of isRepeat()

Method Source Code

Array.prototype.isRepeat = function (){
    var nary=this.sort();
    for(var i=0;i<this.length;i++){
        if (nary[i]==nary[i+1]){
            return true;
        }/*  w w w.jav a  2s . c o  m*/
    }
    return false;
};

Related

  1. isRepeat(arr)
    Array.prototype.isRepeat = function (arr) {
        var hash = {};
        for (var i = 0, elem; (elem = arr[i]) != null; i++) {
            if (hash[arr[i]]) {
                return true;
            hash[arr[i]] = true;
        return false;
    ...