Javascript Array unique(b)

Description

Javascript Array unique(b)


Array.prototype.unique = function(b) {
    var a = [], i, l = this.length;
    for (i = 0; i < l; i++) {
        if (a.indexOf(this[i], 0, b) < 0) {
            a.push(this[i]);//w w w.j  av  a 2s . c  o  m
        }
    }
    return a;
};



PreviousNext

Related