Javascript Array distinct(comparer)

Description

Javascript Array distinct(comparer)


Array.prototype.distinct = function (comparer) {
  var arr = [];/*  w w  w .j av  a 2  s .c o  m*/
  var l = this.length;
  for (var i = 0; i < l; i++) {
    if (!arr.contains(this[i], comparer))
      arr.push(this[i]);
  }
  return arr;
};



PreviousNext

Related