{"ScriptPreparationCode":"\r\nfunction chunk(input, size) {\r\n \r\n const length= input.length;\r\n const chunksLenght= length/size;\r\n \r\n if(chunksLenght\u003C0){\r\n return input;\r\n }\r\n \r\n const chunks=[];\r\n \r\n let index = 0;\r\n \r\n for(let i =0 ;i \u003C chunksLenght ; i\u002B\u002B){\r\n chunks.push(input.slice(index , index \u002B size));\r\n index \u002B= size;\r\n }\r\n \r\n // the remainig \r\n if(index \u003C length){\r\n chunks.push(input.slice(index , length));\r\n }\r\n \r\n \r\n return chunks;\r\n};","TestCases":[{"Name":"Lodash","Code":"_.chunk([\u0027a\u0027, \u0027b\u0027, \u0027c\u0027], 3);","IsDeferred":false},{"Name":"Native","Code":"chunk([\u0027a\u0027, \u0027b\u0027, \u0027c\u0027], 3);\r\n","IsDeferred":false}]}