JS: Set.prototype.entries
(new in ECMAScript 2015)
mySet.entries()-
- Return a Generator.
- Each yield is a array of the form
[value, value].
console.assert( JSON.stringify( Array.from((new Set([3, 4])).entries()), ) === `[[3,3],[4,4]]`, );
Verify Result is a Generator
// verify the result is iterator and iterable const xx = (new Set([3, "yes"])).entries(); // is iterable console.assert(Reflect.has(xx, Symbol.iterator)); // is iterator console.assert(Reflect.has(xx, "next"));