← Back to challenges

Remove Repeated Characters

JavaScriptHardstringsdata_structures

Instructions

Create a function that will remove any repeated character(s) in a word passed to the function. Not just consecutive characters, but characters repeating anywhere in the input.

Examples

unrepeated("hello") ➞ "helo"

unrepeated("aaaaa") ➞ "a"

unrepeated("WWE!!!") ➞ "WE!"

unrepeated("call 911") ➞ "cal 91"

Notes

  • No more than two words will be passed.
  • Try to use new data type introduced in ES6.
  • Notice that a string is iterable.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Distance Between Two Points