{"ScriptPreparationCode":"// Create an array of 1000 random intergers between 1 and 10000\r\nvar arrRandom = [];\r\nfor(var intCtr=0; intCtr\u003C1000; intCtr\u002B\u002B) {\r\n arrRandom.push(Math.floor(Math.random() * Math.floor(10000)));\r\n}\r\n\r\nfunction doRedeuce(pArray, start) {\r\n\treturn pArray.reduce(function(accum, curr) { return accum \u002B curr; }, start);\r\n}\r\nfunction doRedeuceArrowFunc(pArray, start) {\r\n\treturn pArray.reduce((accum, curr) =\u003E accum \u002B curr, start);\r\n}\r\nfunction doLoop(pArray) {\r\n\tvar accum = 0;\r\n\tfor(var intCtr=0; intCtr\u003CpArray.length; intCtr\u002B\u002B) {\r\n\t\taccum \u002B= pArray[intCtr];\r\n\t}\r\n\treturn accum;\r\n}\r\nfunction doForEach(pArray) {\r\n\tvar accum = 0;\r\n\tpArray.forEach(function(item){\r\n\t\taccum \u002B= item;\r\n\t});\r\n}","TestCases":[{"Name":"reduce (arrow function)","Code":"var reduceResult=0;\r\nredeuceResult = doRedeuceArrowFunc(arrRandom, 0);","IsDeferred":false},{"Name":"for loop","Code":"var loopResult=0;\r\nloopResult = doLoop(arrRandom);","IsDeferred":false},{"Name":"forEach ","Code":"var forEachResult=0\r\nforEachResult = doForEach(arrRandom)","IsDeferred":false},{"Name":"reduce","Code":"var reduceResult=0;\r\nredeuceResult = doRedeuce(arrRandom, 0);","IsDeferred":false}]}