{"ScriptPreparationCode":"const arraySize = 10;\r\nwindow.array = _.range(arraySize).map(() =\u003E Math.random());\r\n\r\nfunction manualMethod1(array) {\r\n let x = 0;\r\n let len = array.length;\r\n for (let i = 0; i \u003C len; i\u002B\u002B) {\r\n if (array[i] \u003E .5) {\r\n x\u002B\u002B;\r\n }\r\n }\r\n return x;\r\n}\r\n\r\nfunction manualMethod2(array, test) {\r\n let x = 0;\r\n let len = array.length;\r\n for (let i = 0; i \u003C len; i\u002B\u002B) {\r\n if (test(array[i])) {\r\n x\u002B\u002B;\r\n }\r\n }\r\n return x;\r\n}\r\n\r\nfunction manualMethod3(array, test) {\r\n let x = 0;\r\n for (let i of array) {\r\n if (test(i)) {\r\n x\u002B\u002B;\r\n }\r\n }\r\n return x;\r\n}","TestCases":[{"Name":"Filter length","Code":"const x = _.filter(window.array, i =\u003E i \u003E .5).length;\r\nreturn x;","IsDeferred":false},{"Name":"lodash sumBy","Code":"const x = _.sumBy(window.array, i =\u003E i \u003E .5 ? 1 : 0);\r\nreturn x;","IsDeferred":false},{"Name":"lodash filter chaining","Code":"const x = _(window.array).filter(i =\u003E i \u003E .5).size();\r\nreturn x;","IsDeferred":false},{"Name":"manualMethod1","Code":"return manualMethod1(window.array);","IsDeferred":false},{"Name":"manualMethod2 (with lambda function test)","Code":"return manualMethod2(window.array, i =\u003E i \u003E .5);","IsDeferred":false},{"Name":"manualMethod3 (for-each loop, with lambda function test)","Code":"return manualMethod3(window.array, i =\u003E i \u003E .5);","IsDeferred":false}]}