js数组中删除重复值的代码小结


var arr = ["123","123","123","123","sfsdf","123","345","123","123","345","456","567","sdc"];
var str = [];
for(var i = 0,len = arr.length;i < len;i++){
! RegExp(arr[i],"g").test(str.join(",")) && (str.push(arr[i]));
}
alert(str);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdfxwz.html