How to remove consecutive duplicate characters in JavaScript | Hacker News Reader