1.取唯一值[...new Set(array)]
const array = [1, 2, 3, 2, 4, 5, 3, 5];
// 使用Set去除重复元素
const uniarray = [...new Set(array)];
console.log(uniarray); // 输出: [1, 2, 3, 4, 5]
2.排序
var u = [1,3,2,5,4];
var uu = u.sort();
console.log(uu);
var u = [1,3,2,5,4];
var uuu = u.sort((a,b)=>{return a-b});
console.log(uuu);
3.时间排序
var p = ["2022-01-07", "2021-01-09", "2023-01-10", "2022-01-11", "2022-01-12", "2022-01-p.sort((a, b) => new Date(a) - new Date(b));
console.log(p);
var pp = [{date:"2022-01-07",l:'er'},{date:"2021-01-07",l:'err'},{date:"2023-01-07",l:'ero'},{date:"2022-05-07",l:'epr'}];
pp.sort((a, b) => new Date(a.date) - new Date(b.date));
console.log(pp);