#JavaScript - remove adjacent duplicated characters

A simple replace regular expression to remove adjacent duplicated characters from a given string in js

string.replace(/(.)(?=\\1)/g, '')

For example

var string = 'aaaaaaaaaabccccccccccccccccccccdedfgh ijjjjjjjjjjkkkkkkll'
var processed = string.replace(/(.)(?=\1)/g, '')
// processed is 'abcdedfgh ijkl'

Explanation: