JS: Set.prototype.values
(new in ECMAScript 2015)
Set.prototype.values
mySet.values()-
Return a Generator for the entries.
const xx = new Set([3, 4, 5]); for (let k of xx.values()) { console.log(k); } // 3 // 4 // 5 const xx = (new Set([3, 4, 5])).values(); // is iterable console.assert( Reflect.has(xx, Symbol.iterator), ); // is iterator console.assert( Reflect.has(xx, "next"), );
Set.prototype[Symbol.iterator]
mySet[Symbol.iterator] is the same as mySet.values.
const xx = new Set(); console.assert( xx[Symbol.iterator] === xx.values, );