Members
获取集合中的项目数量。
获取集合中所有值的无序数组。
这是一个实时数组,会自动反映集合中的值,
不应直接修改。
Methods
从集合中移除键值对。
| Name | Type | Description |
|---|---|---|
key |
string | number | 要移除的键。 |
Returns:
如果已移除则返回true,如果键不在集合中则返回false。
检索与提供的键关联的值。
| Name | Type | Description |
|---|---|---|
key |
string | number | 要检索其值的键。 |
Returns:
关联的值;如果键不存在于集合中则返回undefined。
确定提供的键是否存在于数组中。
| Name | Type | Description |
|---|---|---|
key |
string | number | 要检查的键。 |
Returns:
如果键存在于数组中则返回
true,否则返回false。
清空集合。
将提供的键与提供的值关联。如果键已存在,
则使用新值覆盖。
| Name | Type | Description |
|---|---|---|
key |
string | number | 唯一标识符。 |
value |
T | 要与提供的键关联的值。 |
