I have found a way to remove repeated characters from a string using regular expressions.
function RemoveDuplicates() { var str = \"aaabbbccc\"; var
This is an old question, but in ES6 we can use Sets. The code looks like this:
var test = 'aaabbbcccaabbbcccaaaaaaaasa'; var result = Array.from(new Set(test)).join(''); console.log(result);