标签:function -- remove 试题 turn write tmp 面试题 rem
1 function dupRemove(arr){ 2 var tmp = []; 3 for(var i=0;i<arr.length;i++){ 4 for(var j=i+1;j<arr.length;j++){ 5 if(arr[i] === arr[j]){ 6 j = ++i; 7 } 8 } 9 tmp.push(arr[i]); 10 } 11 return tmp; 12 } 13 14 var list = [10,20,50,60,10,20,‘a‘,‘v‘,‘a‘]; 15 document.write(dupRemove(list)); //50,60,10,20,v,a
标签:function -- remove 试题 turn write tmp 面试题 rem
原文地址:https://www.cnblogs.com/ommph/p/11431016.html