Javascript Set is super set
function isSuperset (setA, subset) { for (var elem of subset) { if (!setA.has(elem)) { return false; }//w w w . ja v a2 s . c o m } return true; } var setA = new Set([1, 2, 3, 4]), setB = new Set([2, 3]), setC = new Set([5]); let a = isSuperset(setA, setB); console.log(a);