comparing ECMA6 sets for equality
You can also try:
var a = new Set([1,2,3]);
var b = new Set([1,3,2]);
let areSetsEqual = (a, b) => a.size === b.size && [...a].every(value => b.has(value));
console.log(areSetsEqual(a,b))
Try this:
const eqSet = (xs, ys) =>
xs.size === ys.size &&
[...xs].every((x) => ys.has(x));
const ws = new Set([1, 2, 3]);
const xs = new Set([1, 3, 2]);
const ys = new Set([1, 2, 4]);
const zs = new Set([1, 2, 3, 4]);
console.log(eqSet(ws, xs)); // true
console.log(eqSet(ws, ys)); // false
console.log(eqSet(ws, zs)); // false