{"ScriptPreparationCode":"var CHUNK_SIZE = 500;\r\nvar list = [];\r\nfor (var i = 0; i \u003C 1E6; i\u002B\u002B) {\r\n list.push(i);\r\n}","TestCases":[{"Name":"slice","Code":"let chunks = [];\r\nlet chunkStartIndex = 0;\r\nwhile (chunkStartIndex \u003C list.length) {\r\n chunks.push(list.slice(chunkStartIndex, chunkStartIndex \u002B= CHUNK_SIZE));\r\n}","IsDeferred":false},{"Name":"splice from the beginning","Code":"let chunks = [];\r\nwhile (list.length) {\r\n chunks.push(list.splice(0, CHUNK_SIZE));\r\n}","IsDeferred":false},{"Name":"splice from the end","Code":"const remainder = list.length % CHUNK_SIZE;\r\nlet chunkIndex = Math.ceil(list.length / CHUNK_SIZE);\r\nlet chunks = new Array(chunkIndex);\r\nif (remainder) chunks[--chunkIndex] = list.splice(list.length - remainder);\r\nwhile (--chunkIndex \u003E= 0) chunks[chunkIndex] = list.splice(chunkIndex * CHUNK_SIZE);","IsDeferred":false}]}