📅  最后修改于: 2020-10-25 04:41:57             🧑  作者: Mango
JavaScript Set对象用于存储具有唯一值的元素。这些值可以是任何类型,即原始值或对象引用。
new Set([iterable])
可迭代-表示一个可迭代对象,其元素将添加到新Set中。
让我们看一下JavaScript set方法及其说明的列表。
Methods | Description |
---|---|
add() | It adds the specified values to the Set object. |
clear() | It removes all the elements from the Set object. |
delete() | It deletes the specified element from the Set object. |
entries() | It returns an object of Set iterator that contains an array of [value, value] for each element. |
forEach() | It executes the specified function once for each value. |
has() | It indicates whether the Set object contains the specified value element. |
values() | It returns an object of Set iterator that contains the values for each element. |