Nodejs Array Remove Duplicate removeDuplicateValues()

Here you can find the source of removeDuplicateValues()

Method Source Code

Array.prototype.removeDuplicateValues = function () {
    return this.filter(function (elem, pos, self) {
        return self.indexOf(elem) === pos;
    });//from  w  w w .j a  v  a2s .  co  m
};

Related

  1. removeDuplicate()
    Array.prototype.removeDuplicate = function() {
      return this.reduce(function(last,current){
        if(last.indexOf(current) === -1){
          last.push(current);
        return last;
      },[])
    };
    var array = [1,1,2,1,3,4,12,4,5,,12,3,4];
    ...
    
  2. removeDuplicate()
    Array.prototype.removeDuplicate = function()
      var tmp = [];
      var agent = {};
      for( var i = 0; i < this.length; i++ )
        if( !agent.hasOwnProperty( this[ i ] ) )
          agent[ this[ i ] ] = { val: this[ i ], index: i };
      console.log( agent );
      for( var ns in agent )
        var d = agent[ ns ];
        tmp[ d.index ] = d.val;
      for( i = tmp.length - 1; i > 0; i-- )
        if( is_empty( tmp[ i ] ) ) tmp.splice( i, 1 );
      return tmp;
    };
    
  3. removeDuplicateDates()
    Array.prototype.removeDuplicateDates = function() {
      var u = [];
      for ( var i = 0; i < this.length; i++ ) {
        var current = new Date(this[i]);
        if ( u.map(Number).indexOf(+current) < 0 ) {
          u.push(current);
      return u;
    ...
    
  4. removeDuplicateValues()
    Array.prototype.removeDuplicateValues = function () {
        return this.filter(function (elem, pos, self) {
            return self.indexOf(elem) == pos;
        });
    
  5. removeDuplicatedValues()
    Array.prototype.removeDuplicatedValues = function (){
        var lArray  = this || [];
        var lLength = lArray.length;
        for (var i = lLength - 1; i > -1; i--){
            if (lArray.indexOf(lArray[i]) != i){
                lArray.splice(i, 1);
        if (lLength != lArray.length){
    ...
    
  6. removeDuplicates()
    Array.prototype.removeDuplicates = function() {
        var array = this;
        return array.filter(function(elem, pos) {
            return array.indexOf(elem) == pos;
        })
    };
    
  7. removeDuplicates()
    Array.prototype.removeDuplicates = function() {
      var results = [];
      for (var i = 0; i < this.length; i++) {
        var fail = false;
        for (var j = 0; j < results.length; j++) {
          if (isSameArray(results[j], this[i])) {
            fail = true;
            break;
        if (!fail) results.push(this[i]);
      return results;
    var isSameArray = function(a1, a2) {
      if (a1.length != a2.length) return false;
      for (var i = 0; i < a1.length; i++) if (!~a2.indexOf(a1[i])) return false;
      return true;
    
  8. removeDups()
    Array.prototype.removeDups = function () {
      var len = this.length, arr = [], obj = {}, i;
      for (i = 0; i < len; ++i) {
        obj[this[i]] = 0;
      for (i in obj) {
        arr.push(i);
      return arr;
    ...