1 //判断数组中是否有相同的元素 2 function removeDuplElem(array) 3 { 4 var tempbool = ""; 5 for(var i=0; i<array.length; i++) 6 { 7 for(var j=i+1; j<array.length;j++) 8 { 9 if(array[i]==array[j]) 10 { 11 return tempbool = true; 12 break; 13 } 14 else 15 { 16 return tempbool =false; 17 } 18 } 19 } 20 //return tempbool; 21 }
转载于:https://www.cnblogs.com/SmallWood/archive/2012/08/23/2652219.html