📘Set
🚧 under construction
JS ⟩ value ⟩ object⟩ built-in ⟩ Set
// array -> set
const s = new Set([1, 2, 3, 4])
// set -> array
[...s] // [1, 2, 3, 4] instance methods:
add(value) - 將元素加入集合中。
delete(value) - 刪除元素。
clear() - 清除集合。
has(value) - 元素是否在集合中。
iteration methods:
values()
keys()
entries()
forEach()
MDN ⟩ Set
Last updated
Was this helpful?