If you ever need to remove all duplicate characters from a string you can use this snippet which takes advantage of how the String.prototype.replace()
function works along with regular expressions:
Feel free to use this function in your code. Happy coding š