标签:数组去重 func ++ war logs == code contain length
1 <script> 2 function hasContain(arr,num) { 3 for(var i=0;i<arr.length;i++){ 4 if(arr[i]==num){ 5 return true; 6 } 7 } 8 return false; 9 } 10 11 var arr=[1,2,3,4,5,2,3,8,4]; 12 var newArr=[]; 13 14 for(var i=0;i<arr.length;i++){ 15 if(!hasContain(newArr,arr[i])){ 16 newArr.push(arr[i]) 17 } 18 } 19 alert(newArr); //1,2,3,4,5,8 20 </script>
标签:数组去重 func ++ war logs == code contain length
原文地址:http://www.cnblogs.com/miaoxiaojiao/p/7689391.html