📖

[TypeScript]配列の値の重複を排除する

2023/11/28に公開
const duplicate = [1, 1, 2, 3];
const unique = [...new Set(duplicate)];
console.log(unique); // [1, 2, 3]

参考
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Spread_syntax

https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Set

Discussion