{"ScriptPreparationCode":null,"TestCases":[{"Name":"short","Code":"const getAllSubsets = \r\n theArray =\u003E theArray.reduce(\r\n (subsets, value) =\u003E subsets.concat(\r\n subsets.map(set =\u003E [value,...set])\r\n ),\r\n [[]]\r\n );\r\n\r\ngetAllSubsets([1,2,3,4,5,6])","IsDeferred":false},{"Name":"longer","Code":"const wrap = (variant) =\u003E [variant].flat()\r\n\r\nconst combo = ([head, ...rest], items) =\u003E (!head ? [items] : [...combo(rest, [...items, head]), ...combo(rest, items)])\r\n\r\nconst getCombinations = (items, separator = \u0022/\u0022) =\u003E\r\n combo(wrap(items), [])\r\n .sort((a, b) =\u003E b.length - a.length)\r\n .map((part) =\u003E part.join(separator))\r\n\r\ngetCombinations([1,2,3,4,5,6])","IsDeferred":false}]}