{"ScriptPreparationCode":"var arr = [];\r\nvar max = -Infinity;\r\nfor (i = 0; i \u003C 4096; i\u002B\u002B) { \r\n arr.push(Math.random() * i);\r\n}\r\n\r\nfunction mathMax (array) {\r\n\treturn Math.max.apply(Math, array);\r\n}","TestCases":[{"Name":"Math.max.apply","Code":"max = Math.max.apply(Math, arr);","IsDeferred":false},{"Name":"Math.max with spread","Code":"max = Math.max(...arr);","IsDeferred":false},{"Name":"basic for loop","Code":"for (let i = 0; i \u003C arr.length; i\u002B\u002B) {\r\n if (arr[i] \u003E max) {\r\n max = arr[i];\r\n }\r\n}","IsDeferred":false},{"Name":"for loop length caching","Code":"for (let i = 0, len = arr.length; i \u003C len; i\u002B\u002B) {\r\n if (arr[i] \u003E max) {\r\n max = arr[i];\r\n }\r\n}\r\n","IsDeferred":false},{"Name":"for loop reverse","Code":"for (let i = arr.length - 1; i \u003E= 0; i--) {\r\n if (arr[i] \u003E max) {\r\n max = arr[i];\r\n }\r\n}","IsDeferred":false},{"Name":"for-of loop","Code":"for (const value of arr) {\r\n if (value \u003E max) {\r\n max = value;\r\n }\r\n}","IsDeferred":false},{"Name":"Math.max.apply extracted into separate function","Code":"mathMax(arr)","IsDeferred":false}]}