set用于数组去重 HarveyT 2020-01-30 176 阅读1分钟 var arr=[2,2,3,1,4,5,4]; var s=new Set(arr);//将数组转化为set var arr2=Array.from(s);//将set转化为数组 console.log(arr2);