Javascript Array removeSame()

Description

Javascript Array removeSame()


Array.prototype.removeSame = function() {
 let theNewArray = [];
 this.map((value, index, array) => {/* w  w  w  . j av a 2  s . com*/
  if (array.indexOf(value) === index) {
   theNewArray.push(value);
  }
 });
 return theNewArray;
};



PreviousNext

Related