const str = '1112233322';
const arr = str.match(/(\d)\1*/g);
// arr => [111, 22, 333, 22]
const str = '1112233322';
const arr = str.match(/(\d)\1*/g);
// arr => [111, 22, 333, 22]
本文标题:match方法对相同数字进行分组
本文链接:https://www.haomeiwen.com/subject/nswzsktx.html
网友评论