The chunky monkey challenge [Spoiler]

i got passed this challenge but i just feel like i used to much arithmetic or there was a much easier way. Would this solution be considered bad practice?

function chunkArrayInGroups(arr, size) {
// Break it up.
var result=[];
var miniarray=[];

var i=0;
while ( i<arr.length/size ){
result.push(arr.slice(i * size,size+(size * i)));
i++;
}

return result;
}

chunkArrayInGroups([0,1,2,3,4,5], 2);

Not using the code button and posting code as normal text is considered bad practice :stuck_out_tongue:

Your code seems to be okay, although you declare an unnecessary variable (miniarray). Another improvement would be to use splice() instead of slice(). Feel free to check the difference between the two functions and if you could improve your function with splice().

Thank you. I will remember to use the code button next time.