JS: Set.prototype.entries
(new in JS: ECMAScript 2015)
mySet.entries()
-
- Return a Generator.
- Each yield is a array of the form
[value, value]
.
console.log( 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.log(Reflect.has(xx, Symbol.iterator)); // true // is iterator console.log(Reflect.has(xx, "next")); // true