{"ScriptPreparationCode":"var arr = [\r\n { name: \u0027john\u0027, hasPet: true },\r\n { name: \u0027jack\u0027, hasPet: false },\r\n { name: \u0027jill\u0027, hasPet: false },\r\n { name: \u0027james\u0027, hasPet: true },\r\n { name: \u0027jane\u0027, hasPet: false },\r\n]","TestCases":[{"Name":"_.partition","Code":"_.partition(arr, el =\u003E el.hasPet);","IsDeferred":false},{"Name":"ES6 partition with for..of","Code":"const partition = (arr, fun) =\u003E {\r\n const positive = [];\r\n const negative = [];\r\n for (el of arr) {\r\n if (el.hasPet) {\r\n positive.push(el);\r\n } else {\r\n negative.push(el);\r\n }\r\n }\r\n return [positive, negative];\r\n};\r\npartition(arr, el =\u003E el.hasPet);","IsDeferred":false},{"Name":"ES partition with filter","Code":"const partition = (arr, fun) =\u003E {\r\n const positive = arr.filter(fun);\r\n const negative = arr.filter(el =\u003E !fun(el));\r\n return [positive, negative];\r\n};\r\npartition(arr, el =\u003E el.hasPet);","IsDeferred":false}]}