$ ls ~yifei/notes/

EcmaScript Set

Posted on:

Last modified:

basic usage

let set = new Set();
let set = new Set([a, b, c]);

set.size  // the size of set
set.add(a)
set.delete(a)
set.clear()
set.has(value)
set.keys()  // the same as keys
set.values()  // return the values as a iterator

Reference

  1. MDN set

© 2016-2022 Yifei Kong. Powered by ynotes

All contents are under the CC-BY-NC-SA license, if not otherwise specified.

Opinions expressed here are solely my own and do not express the views or opinions of my employer.