Methods1:思路:先将原数组排序,在与相邻的进行比较,如果不同则存入新数组。functionunique2(arr){varformArrarr.sort()varnewArr[formArr[0]]for(leti1;i<formArr.length;i++){if(formArr[i]!formArr[i1]){newArr.push(formArr[i])}}returnnewArr}console.log(unique2([1,1,2,3,5,3,1,5,6,7,4]));结果是[1,2,3,4,5,6,7]Methods2:利用对象属性存在的特性,如果没有该属性则存入新数组。functionunique3(arr){varobj{}varnewAr...