{"ScriptPreparationCode":"var setsUnion = (sets) =\u003E {\r\n if (sets.length === 1) {\r\n return sets[0];\r\n }\r\n\r\n const result = new Set();\r\n for (const set of sets) {\r\n for (const item of set) {\r\n result.add(item);\r\n }\r\n }\r\n\r\n return result;\r\n};\r\nvar setsDifference = (from, sets) =\u003E {\r\n const result = new Set();\r\n for (const value of from) {\r\n let add = true;\r\n for (const set of sets) {\r\n if (set.has(value)) {\r\n add = false;\r\n break;\r\n }\r\n }\r\n if (add) {\r\n result.add(value);\r\n }\r\n }\r\n\r\n return result;\r\n};\r\nvar setsDifference2Args = (from, set) =\u003E {\r\n const result = new Set();\r\n for (const value of from) {\r\n let add = true;\r\n if (set.has(value)) {\r\n add = false;\r\n break;\r\n }\r\n if (add) {\r\n result.add(value);\r\n }\r\n }\r\n\r\n return result;\r\n};\r\nvar setsDifferenceModify = (from, sets) =\u003E {\r\n for (const value of from) {\r\n for (const set of sets) {\r\n if (set.has(value)) {\r\n from.delete(value);\r\n break;\r\n }\r\n }\r\n }\r\n};\r\nvar setsDifferenceModify2Args = (from, set) =\u003E {\r\n for (const value of from) {\r\n if (set.has(value)) {\r\n from.delete(value);\r\n break;\r\n }\r\n }\r\n};\r\n\r\nvar from = new Set([3, 5, 1, 8, 4, 10, 46, 33, 21, 345, 14, 72, 5, 3, 6, 7, 8, 9, 10]);\r\nvar sets = [\r\n new Set([9, 10, 46, 21, 66, 100, 200, 300, 400, 2]),\r\n new Set([6, 15, 22, 2, 10, 66, 1, 0, 900]),\r\n new Set([22, 15, 21, 4, 1, 3, 0, 200])\r\n];","TestCases":[{"Name":"setsDifference(from, sets)","Code":"const result = setsDifference(from, sets);","IsDeferred":false},{"Name":"setsDifference(from, setsUnion(sets))","Code":"const result = setsDifference2Args(from, setsUnion(sets));","IsDeferred":false},{"Name":"setsDifferenceModify(from, sets)","Code":"setsDifferenceModify(from, sets);","IsDeferred":false},{"Name":"setsDifferenceModify(from, setsUnion(sets))","Code":"setsDifferenceModify2Args(from, setsUnion(sets));","IsDeferred":false}]}