正则表达式去重
var str = 'afjasoeigjs123sgdh1edhhe456osddhnofd789';
var reg = str.replace(/[^0-9]/ig, "");
var arr2 = [];
for (var i = 0; i < reg.length; i++) {
if (arr2.indexOf(reg[i]) < 0) {
arr2.push(reg[i])
}
}
console.log(arr2);
代码改变了我们,也改变了世界