标签:java color length 去除 push cti class 去掉 []
//完美去除法:
var arr=[1,3,2,2,11,4]; var arr1=[]; var arr2=arr.sort(function(a,b){ return a-b; }); //把数组进行排序 var num=1; for (var i=0;i<arr2.length;i++){ if(arr2[i]!==arr2[(num++)]){ arr1.push(arr[i]); } } console.log(arr1);
标签:java color length 去除 push cti class 去掉 []
原文地址:http://www.cnblogs.com/weven/p/7183191.html