let arr =[1,2,3,2,3,5,4,7];let map =newMap();for(let i =0; i < arr.length; i++){
map.set(arr[i], arr[i]);}
console.log(Array.from(map.values()));
indexOf indexOf其实也算一层循环。时间复杂度为O(n^2)
var newArr =[];for(let i =0; i < arr.length; i++){if(newArr.indexOf(arr[i])==-1){
newArr.push(arr[i]);};}
console.log(newArr);//无法去重 NaN,可以使用 ES2016 引进的数组方法//[1, 2, NaN].includes( NaN ) === true