es6数组排序去重

const array = [1,1,20,2,3,3,4,53,34]
const array1 = [...new Set(array)]
console.log(array1.sort((a, b)=>{
return a - b;
}))

new Set   去重

arr.sort   //排序

具体使用可参考手册:http://www.w3school.com.cn/js/jsref_sort.asp

 

posted @ 2019-07-04 10:56  飞鱼123  阅读(3190)  评论(0编辑  收藏  举报