Last updated 1 year ago
JS ⟩ value ⟩ object⟩ built-in ⟩ Set ⟩ extension ⟩ .isEqualTo()
replit ⟩ Set Equality (old code)
// isEqualSets(a,b) function isEqualSets(a, b){ if (a.size !== b.size) return false; return Array.from(a).every(elem => b.has(elem)); } // setA.equal(setB) Set.prototype.equal = function(setB){ return isEqualSets(this, setB); }
👉
array.every(), Array.from()
Set
comparing ECMA6 sets for equality