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);
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);