Javascript Array equals(other)

Description

Javascript Array equals(other)

Array.prototype.equals = function(other) {
    if (!other)/*from  ww w. ja  v  a 2 s .  c  om*/
        return false;

    if (other == this)
        return true;

    if (this.length != other.length)
        return false;

    for (var i = 0, l=this.length; i < l; i++) {
        if (this[i] != other[i]) {
            return false;
        }
    }

    return true;
};



PreviousNext

Related