数组去重(驱虫)的两种方法
var text = [1,2,3,"a","a",1,1,2,2,3,3,4,5,5,3,9,"b","b",3]方法一思路是在原数组中提取数与新组比较,新数组中无该值就添加进去 var newText = [] for(i=0;i<text.length;i++){ if(newText.indexOf(text[i]) == -1){ newText.push(text[i]) ...
原创
2022-03-19 18:03:38 ·
457 阅读 ·
0 评论