{"ScriptPreparationCode":"var arr = Array(10_0).fill(Array(10).fill(Array(10).fill(0)))\r\nfunction flattenReducer(arr) {\r\n return arr.reduce((acc, cur) =\u003E acc.concat(Array.isArray(cur) ? flattenReducer(cur) : cur), []);\r\n};\r\nfunction* flattenGenerator(arr)\r\n{\r\n for (const val of arr) {\r\n Array.isArray(val) ? yield* flattenGenerator(val) : yield val;\r\n }\r\n}\r\nfunction recursiveFlatten(arr) {\r\n const result = [];\r\n arr.forEach(item =\u003E {\r\n if (Array.isArray(item)) {\r\n result.push(...recursiveFlatten(item));\r\n }\r\n else {\r\n result.push(item);\r\n }\r\n });\r\n return result;\r\n};","TestCases":[{"Name":"Using reducer","Code":"flattenReducer(arr)","IsDeferred":false},{"Name":"Using generators","Code":" [...flattenGenerator(arr)]","IsDeferred":false},{"Name":"Recursive push flatten","Code":"recursiveFlatten(arr)","IsDeferred":false},{"Name":"Using array flat","Code":"arr.flat(Infinity)","IsDeferred":false}]}