{"ScriptPreparationCode":" const chunks = [\r\n [1, 2, 3],\r\n [4, 5],\r\n [7],\r\n [8],\r\n [1, 3, 5, 6, 7]\r\n ];","TestCases":[{"Name":"for","Code":" const chunks = [\r\n [1, 2, 3],\r\n [4, 5],\r\n [7],\r\n [8],\r\n [1, 3, 5, 6, 7]\r\n ]; \r\n\r\nconst result = [];\r\n let resultIndex = 0;\r\n\r\n for (const chunk of chunks) {\r\n for (let i = 0; i \u003C chunk.length; i\u002B\u002B) {\r\n const value = i === 0;\r\n result[resultIndex\u002B\u002B] = value;\r\n }\r\n }\r\n\r\n return result;","IsDeferred":false},{"Name":"reduce","Code":" const chunks = [\r\n [1, 2, 3],\r\n [4, 5],\r\n [7],\r\n [8],\r\n [1, 3, 5, 6, 7]\r\n ];\r\n\r\nreturn chunks.reduce((acc, chunk) =\u003E {\r\n const booleanChunk = Array.from({ length: chunk.length }, (value, index) =\u003E {\r\n return index === 0; // First item of the chuck will be true, all other be false\r\n });\r\n acc.push(...booleanChunk);\r\n return acc;\r\n }, []);","IsDeferred":false}]}