Javascript String unique()

Description

Javascript String unique()

String.prototype.unique = function() {
  var temp = {};//from w w w  . j  av  a  2s .c o m
  this.split('').forEach(elem => {
    temp[elem] = 0;
  });
  return Object.keys(temp).join('');
};



PreviousNext

Related