/*删除数组中的重复元素,并返回去重的数组*/ function delRepeatNum(arr){ var result = []; var middleObj = {}; var temp; for(var i = 0; i < arr.length; i++){ temp = arr[i]; middleObj[temp] = 1; } for(temp in middleObj){ result.push(temp); } return result; }
/*删除数组中的重复元素,并返回去重的数组*/ function delRepeatNum(arr){ var result = []; var middleObj = {}; var temp; for(var i = 0; i < arr.length; i++){ temp = arr[i]; middleObj[temp] = 1; } for(temp in middleObj){ result.push(temp); } return result; }