JS 数组转集合(数组去重)
let Num=[1, 2, 3, 4, 5, 6, 1, 1, 1 ]
let Num1=new Set(Num);
console.log(Num);//[1, 2, 3, 4, 5, 6, 1, 1, 1 ]
Num = [...Num1];
console.log(Num);//[1,2,3,4,5,6]
版权声明:本文为m0_49986452原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
let Num=[1, 2, 3, 4, 5, 6, 1, 1, 1 ]
let Num1=new Set(Num);
console.log(Num);//[1, 2, 3, 4, 5, 6, 1, 1, 1 ]
Num = [...Num1];
console.log(Num);//[1,2,3,4,5,6]