Javascript Array compareArrays(arr)

Description

Javascript Array compareArrays(arr)


Array.prototype.compareArrays = function(arr) {
    if (this.length != arr.length) return false;
    for (var i = 0; i < arr.length; i++) {
        if (this[i].compareArrays) { //likely nested array
            if (!this[i].compareArrays(arr[i])) return false;
            else continue;//from ww w .java2  s .  c o m
        }
        if (this[i] != arr[i]) return false;
    }
    return true;
};



PreviousNext

Related