{"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 reduceCallback(accum, curr) {\r\n\treturn [\r\n ...accum,\r\n curr\r\n ];\r\n}\r\n\r\nfunction doRedeuce(pArray) {\r\n\treturn pArray.reduce(reduceCallback, []);\r\n}\r\nfunction doLoop(pArray) {\r\n\tvar newArray = [];\r\n\tfor(var intCtr=0; intCtr\u003CpArray.length; intCtr\u002B\u002B) {\r\n newArray.push(pArray[intCtr]);\r\n\t}\r\n\treturn newArray;\r\n}\r\nfunction doForEach(pArray) {\r\n\tvar newArray = [];\r\n\tpArray.forEach(function(item) {\r\n newArray.push(pArray[item]);\r\n\t});\r\n \treturn newArray\r\n}","TestCases":[{"Name":"reduce","Code":"var redeuceResult=0;\r\nredeuceResult = doRedeuce(arrRandom);","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}]}