{"ScriptPreparationCode":"var data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];","TestCases":[{"Name":"slice","Code":"let chunksize = 10;\r\nlet pos = 0;\r\nlet chunk = [];\r\n\r\nwhile (pos \u003C= data.length) {\r\n\tchunk = data.slice(pos, pos \u002B chunksize);\r\n \tconsole.log(chunk);\r\n pos = pos \u002B chunksize;\r\n}\r\n","IsDeferred":false},{"Name":"push","Code":"let chunksize = 10;\r\nlet pos = 0;\r\nlet chunk = [];\r\n\r\nfor (let pos = 0; pos \u003C= data.length; pos\u002B\u002B) {\r\n chunk.push(data[pos]);\r\n \r\n if (pos % chunksize === 0 || pos === data.length) {\r\n \tconsole.log(chunk);\r\n chunk = [];\r\n }\r\n}\r\n ","IsDeferred":false},{"Name":"generator (slice)","Code":"function* getBatch(records, currentPos = 0, chunksize = 10) {\r\n \tlet pos = 0;\r\n \r\n\twhile (pos \u003C= records.length) {\r\n\t\tyield records.slice(pos, pos \u002B chunksize); \t\t\r\n \tpos = pos \u002B chunksize;\r\n\t}\r\n}\r\n\r\n","IsDeferred":false}]}