您的位置: 首页 > IT文章 > Set,Map Set,Map 分类: IT文章 • 2022-05-20 17:25:53 可以使用Set集合的不可重复性来处理js的数组去重: const arr = [1, 2,null,'hellow', 'hellow', 2, null] let set = new Set(arr); console.log(Array.from(set)) // [1,2,null,'hellow'] console.log([...set]) // [1,2,null,'hellow']