How to remove duplicate characters and combine strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to remove duplicate characters and combine strings

I currently have a function function longest(s1,s2) { return s1.concat(s2) .split(“”) .sort() .join() } How can I edit this function to remove duplicate characters from a string?

15th Feb 2019, 11:08 PM
Luke Sandford
2 Answers
16th Feb 2019, 4:19 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
0
thanks but im not sure how to amend the code to remove the duplicate characters i thought it was the .filter() function but i cant see where in the above code i would write it?
16th Feb 2019, 11:53 AM
Luke Sandford