I have a problem, I don't understand why arr.slice doesn't work when the first value is 0, the returned array is empty:
function chunkArrayInGroups(arr, size) {
var newArr = [];
for (var i = 0; arr[i]; i += size) {
newArr.push(arr.slice(i, i + size));
}
return newArr;
}
console.log(chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6], 3));
for (var i = 0; arr[i]; i += size) {?