关于html:第-33-题如何去掉一组整型数组重复的值

1次阅读

共计 268 个字符,预计需要花费 1 分钟才能阅读完成。

利用 ES6 新增的数据结构 Set 实现

let arr = [20, 28, 28, 30, 28, 50, 40];
let res = [...new Set(arr)];

console.log(res); // [20, 28, 30, 50, 40]

文章的内容 / 灵感都从下方内容中借鉴

  • 【继续保护 / 更新 500+ 前端面试题 / 笔记】https://github.com/noxussj/In…
  • 【大数据可视化图表插件】https://www.npmjs.com/package…
  • 【利用 THREE.JS 实现 3D 城市建模(珠海市)】https://3d.noxussj.top/
正文完
 0