Using ES6 new data structure SET implementation

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

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

additional

  • This article is published through multiple platforms of “We Media” and will not be maintained after publication. If you have any objection to the content, you can discuss it in the GitHub below
  • The ongoing maintenance / 500 + face questions before update/notes 】 https://github.com/noxussj/In…
  • [3D city modeling using three. JS (Zhuhai City)] https://3d.noxussj.top/