Here’s what I’ve got:
function chunkArrayInGroups(arr, size) {
var arrayChunks = [];
for (i = 0; i < size; i++) {
arrayChunks.push(arr.slice(0, size));
}
return arrayChunks;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
which results in
[[“a”, “b”], [“a”, “b”]]
I understand what it’s doing wrong, but I can’t wrap my head around why; I feel like I’m missing something fundamental. Any hints, tips, or nudges in the right direction would be appreciated.