📜  获取 set js 中的任何项目 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:04.531000             🧑  作者: Mango

代码示例1
var x = new Set();
x.add(1);
x.add({ a: 2 });
//get iterator:
var it = x.values();
//get first entry:
var first = it.next();
//get value out of the iterator entry:
var value = first.value;
console.log(value); //1