All pastes #756401 Raw Edit

Miscellany

public text v1 · immutable
#756401 ·published 2007-10-31 13:49 UTC
rendered paste body
    Array.prototype.indexOf = function(n) {
        for (var i=0;i<this.length;i++)
            if (this[i] === n)
                return i;
        return -1;
    }
    Array.prototype.unique = function() {
        var a=[],i; this.sort();
        for (i=0;i<this.length;i++) 
            if (this[i]!==this[i+1])
                a[a.length]=this[i];
        return a;
    }