{"ScriptPreparationCode":" var iterations = 50000;\r\n\r\n var a = [];\r\n\r\n for (let i = 0; i \u003C iterations; i\u002B\u002B) {\r\n a.push(Math.round(Math.random() * iterations));\r\n }\r\n\r\n \r\n","TestCases":[{"Name":"Reduce and push","Code":" \r\n\r\n const result = a.reduce((acc, item, index) =\u003E {\r\n if(item % 2 === 0) {\r\n acc.push({ [index]: item });\r\n }\r\n return acc}, \r\n []);\r\n\r\n console.log(\u0022Reduce and push\u0022, result.length);\r\n","IsDeferred":false},{"Name":"Reduce and spread","Code":" \r\n\r\n const result = a.reduce((acc, item, index) =\u003E (item % 2 === 0 ? [...acc, { [index]: item }] : acc), []);\r\n\r\n console.log(\u0022Reduce and spread\u0022, result.length);","IsDeferred":false},{"Name":"Filter and map","Code":" \r\n const result = a.filter(item =\u003E item % 2 === 0).map((oddItem, index) =\u003E ({ [index]: oddItem }));\r\n\r\n console.log(\u0022Filter and map\u0022, result.length);","IsDeferred":false}]}