javascript
ES6 SET & MAP
Set ES6 提供了新的数据结构 Set 。它类似于数组,但其成员的值是唯一的,不会重复。 Set 的简单使用: // 单个添加 const s = new Set(); [2, 3, 5, 4, 5, 2, 2].forEach(x => s.add(x)); for (let i of s) { console.log(i); } // 2 3 5 4 // 将数组转换为 set 对象 const set = new Set([1, 2, 3, 4,