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.
Convert it to an array first, then use the answer here, and rejoin, like so:
var nonUnique = "ababdefegg"; var unique = nonUnique.split('').filter(function(item, i, ar){ return ar.indexOf(item) === i; }).join('');
All in one line :-)