记一个数组去重的办法

使用es6  set

set的值都是唯一的不并不能重复,可以使用set的数据结构来进行数组去重

const set =new Set([1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,4,6,8,0,10])

[...set]

关于...(spread运算符)

就是把数组中的数据一个一个进行传递

http://es6.ruanyifeng.com/#docs/set-map

https://segmentfault.com/a/1190000006887425

原文地址:https://www.cnblogs.com/zhangweihu/p/7519281.html