I have a string with repeated letters. I want letters that are repeated more than once to show only once. For instance I have a string aaabbbccc i want the result to be abc.
Fill a Set with the characters and concatenate its unique entries:
Set
function makeUnique(str) { return String.prototype.concat(...new Set(str)) } console.log(makeUnique('abc')); // "abc" console.log(makeUnique('abcabc')); // "abc"