Set

ES6提供了新的数据结构Set(集合),它类似于数组,但成员的值都是唯一的,集合实现了iterator接口,所以可以使用扩展运算符for...of进行遍历。

Set和Map  Set和Map

 Set和Map Set和Map

 Set和MapSet和Map

 Set和Map Set和Map

 Set和Map Set和Map

 Set和Map Set和Map

 集合使用

 数组去重

Set和Map

 取交集

Set和Map

取并集

Set和Map Set和Map

取差集

 Set和Map

 Map

ES6提供了Map数据结构,它类似于对象,也是键值对的集合,但是"键"的范围不限于字符串,各种类型的值都可以当作键。Map也实现了iterator接口,所以可以使用扩展运算符for...of进行遍历。

Set和Map  Set和Map

 Set和Map Set和Map

 Set和Map Set和Map

相关文章: