pro-array.js
function(isSorted) {
    var result = [];
    var length = this.length;

    if (!length) {
      return result;
    }

    result[0] = this[0];
    var i = 1;

    if (isSorted) {
      for (; i < length; i++) {
        if (this[i] !== this[i - 1]) {
          result.push(this[i]);
        }
      }
    } else {
      for (; i < length; i++) {
        if (result.indexOf(this[i]) < 0) {
          result.push(this[i]);
        }
      }
    }

    return result;
  }
function(isSorted) {
    var result = [];
    var length = this.length;

    if (!length) {
      return result;
    }

    result[0] = this[0];
    var i = 1;

    if (isSorted) {
      for (; i < length; i++) {
        if (this[i] !== this[i - 1]) {
          result.push(this[i]);
        }
      }
    } else {
      for (; i < length; i++) {
        if (result.indexOf(this[i]) < 0) {
          result.push(this[i]);
        }
      }
    }

    return result;
  }
function ( isSorted ) { var result = [ ] ; var length = this . length ; if ( ! length ) { return result ; } result [ 0 ] = this [ 0 ] ; var i = 1 ; if ( isSorted ) { for ( ; i < length ; i ++ ) { if ( this [ i ] !== this [ i - 1 ] ) { result . push ( this [ i ] ) ; } } } else { for ( ; i < length ; i ++ ) { if ( result . indexOf ( this [ i ] ) < 0 ) { result . push ( this [ i ] ) ; } } } return result ; }
Returns a duplicate-free clone of the array.

@function Array#unique
@param {boolean} [isSorted=false] - If the array's contents are sorted and this is set to `true`,
a faster algorithm will be used to create the unique array.
@returns {Array} The new, duplicate-free array.

@example
// Unsorted
[4, 2, 3, 2, 1, 4].unique();
// -> [4, 2, 3, 1]

// Sorted
[1, 2, 2, 3, 4, 4].unique();
// -> [1, 2, 3, 4]

[1, 2, 2, 3, 4, 4].unique(true);
// -> [1, 2, 3, 4] (but faster than the previous example)
Returns a duplicate - free clone of the array .