const s=new Set([1,2,3]); console.log(s); //Set(3) {1, 2, 3} console.log(s.size); //3 s.add('a').add('b').add('c'); console.log(s); //Set(6){1,2,3,'a','b','c'} console.log(s.delete('a')); //true console.log(s.has('a')); //false // s.clear(); // console.log(s); //Set(0){} console.log(s.keys()); console.log(s.values()); console.log(s.entries()); //返回键值对 s.forEach(function(value,key,set){ console.log(value+'miaov'); }); console.log(s);