Remove Dupes

In this lesson, we'll discuss how to remove duplicates from a string. We'll cover two different solutions and see how ES2015 constructs can greatly simplify our code.

Remove Dupes

Instructions

Write a function that takes in a string and returns a new string. The new string should be the same as the original with every duplicate character removed.

Input: String

Output: String

Examples

'abcd' -> 'abcd'
'aabbccdd' -> 'abcd'
'abcddbca' -> 'abcd'
'abababcdcdcd' -> 'abcd'

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.