{"ScriptPreparationCode":"var arr = [];\r\nfor (i = 0; i \u003C 1000; i\u002B\u002B) {\r\n var val = Math.random() * i\r\n arr.push({\r\n val\r\n })\r\n}","TestCases":[{"Name":"Array.sortBy","Code":"var sorted = arr.sort((datum1, datum2) =\u003E {\r\n const val1 = datum1.val\r\n const val2 = datum2.val\r\n if (typeof val1 !== \u0027undefined\u0027 \u0026\u0026 typeof val2 !== \u0027undefined\u0027) {\r\n if (val1 \u003C val2) {\r\n return -1\r\n } else if (val2 \u003E val1) {\r\n return 1\r\n }\r\n }\r\n return 0\r\n })\r\nvar max = sorted[sorted.length - 1]\r\nvar min = sorted[0]","IsDeferred":false},{"Name":"Array.Reduce","Code":"var result = arr.reduce(\r\n (minMax, d) =\u003E {\r\n var { min, max } = minMax\r\n var dataVal = d.val\r\n if (dataVal !== undefined) {\r\n return { min: Math.min(min, dataVal), max: Math.max(max, dataVal) }\r\n }\r\n return minMax\r\n },\r\n { min: Infinity, max: -Infinity }\r\n )","IsDeferred":false}]}