SOURCE

const s =new Set();
[1,1,3,4,5,6,7,8].forEach(x=>s.add(x));

for(let i of s){
    console.log(i);
}

console.log("----------------")
const set=new Set([1,2,2,2,2]);
const a=[...new Set([1,2,3,4,5])];
console.info(a);
const b=[...new Set('abbacd')].join('-');
console.info(b);
console.log(...set);
console.log(set.size);

const setdiv=new Set(document.querySelectorAll('div'));
console.info(...setdiv);
console.info(setdiv.size);

const setdiv2=new Set();
document.querySelectorAll('div').forEach(div=>setdiv2.add(div));
console.info(...setdiv2);


for (let i = 0; i < 3; i++) {
  let i = 'abc';
  console.log(i);
}


//变量提升
var tmp = new Date();
function f() {
  console.log(tmp);
  if (false) {
     tmp = 'hello world';
  }
}

f(); // undefi
console 命令行工具 X clear

                    
>
console