EcmaScript Set


Author: yifei / Created: June 12, 2017, 8:14 a.m. / Modified: June 12, 2017, 8:14 a.m. / Edit

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:

MDN set


有任何问题可以发邮件到 kongyifei (at) gmail.com 讨论