My solution Chunky Monkey Bonfire [didn't use splice]

My solution Chunky Monkey Bonfire [didn't use splice]
0.0 0

#1

Hello everyone,

I just completed the Chunky Monkey Bonfire. However, I didn’t use Array.prototype.slice() and instead used Array.prototype.splice(). I haven’t looked up what the answer is using .slice() because I still haven’t figured it out using that method… Is my solution okay for the purpose of this exercise? Just want to make sure it’s not an anomaly and any feedback would be great.

Thanks.

START OF CODE:

function chunkArrayInGroups(arr, size) {

var element = [];
var newArray = [];
var newt = [];

for (var i=0; i <arr.length; i++) {

element = arr.splice(i,size, 0);

newArray.push(element);

} //end of for loop

return newArray;
}

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

END OF CODE