function chunkArrayInGroups(arr, size) {
var newArr = []; //holds the new array with the chunks
for (var i = 0; i < arr.length; i++) { //loop through the arr argument
if (i % size === 0) { //checks to see if were at the size limit to slice the arr argument
newArr.push(arr.slice(i, i + size)); // slice and push chunks to our new arr
}
} return newArr; //returns our array with chunks
}
I looked through other peoples solutions as well as the hints and didn’t find this answer anywhere.
This solution will pass the test but is this a good solution?