Skip to content

Commit f3e9943

Browse files
authoredFeb 24, 2022
Create removeDupeChars.js
1 parent 9c41c58 commit f3e9943

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎removeDupeChars.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function removeDupeChars(e, r = !1) {
2+
return e.split("").filter((e, i, n) => n[i] !== n[r ? i + 2 : i + 1]).join("");
3+
}
4+
5+
/* Example Outputs: */
6+
removeDupeChars('Hellooooooo, how are youuuuuuuu?????') // Hello, how are you?????
7+
removeDupeChars('Wow, that code is really short!', true) // Wow, that code is really short!
8+
removeDupeChars('Ssssshhhhh, be quiet please!') // Ssh, be quiet please!

0 commit comments

Comments
 (0)
Please sign in to comment.