Javascript Array same()

Description

Javascript Array same()



// Extension to check if two arrays are identical
Array.prototype.same = function() {
    for(var i = 1; i < this.length; i++) {
        if(this[i] !== this[0])
            return false;
    }//from ww w.  ja  va2 s.c  o m

    return true;
}



PreviousNext

Related