js删除字符串中相邻的重复项

 let res = 'aabbaaaaccdeee'.replace(/(.)\1*/g, '$1');  
 console.log(res)// abacde

posted on 2022-03-29 10:02  GameCat  阅读(196)  评论(0)    收藏  举报

导航