{"ScriptPreparationCode":"//Create an array of 10000 random intergers between 1 and 10000\r\nvar arrRandom = [];\r\nfor(var intCtr=0; intCtr\u003C10000; intCtr\u002B\u002B) {\r\n arrRandom.push(Math.floor(Math.random() * Math.floor(10000)));\r\n}\r\n\r\nfunction reduceCallback(accum, curr) {\r\n\treturn accum\u002Bcurr;\r\n}\r\n\r\nfunction doReduce(pArray) {\r\n\treturn pArray.reduce(reduceCallback);\r\n}\r\nfunction doForLoop(pArray) {\r\n\tvar accum = 0;\r\n\tvar arrLength = pArray.length;\r\n\tfor(var intCtr=0; intCtr\u003CarrLength; intCtr\u002B\u002B) {\r\n\t\taccum \u002B= pArray[intCtr];\r\n\t}\r\n\treturn accum;\r\n}\r\nfunction doForOfLoop(pArray) {\r\n\tvar accum = 0;\r\n\tfor(var value of pArray) {\r\n\t\taccum \u002B= value;\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","Code":"var redeuceResult=0;\r\nredeuceResult = doReduce(arrRandom);","IsDeferred":false},{"Name":"for loop","Code":"var loopResult=0;\r\nloopResult = doForLoop(arrRandom);","IsDeferred":false},{"Name":"forEach ","Code":"var forEachResult=0\r\nforEachResult = doForEach(arrRandom)","IsDeferred":false},{"Name":"for of loop","Code":"var forOfResult=0\r\nforOfResult = doForOfLoop(arrRandom)","IsDeferred":false}]}