← Back to challenges

Remove Repeated Letters

JavaScriptHardstringsloops

Instructions

Create a function that replaces all consecutively repeated letters in a word with single letters.

Examples

removeRepeats("aaabbbccc") ➞ "abc"

removeRepeats("bookkeeper") ➞ "bokeper"

removeRepeats("nananana") ➞ "nananana"

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Replace Letters With Position In Alphabet