I’m doing the chunky monkey challenge. My current code can only return the first two parts of the array. I think the issue lies within the newArray
part but I’m not 100% sure. Here’s the full code.
function chunkArrayInGroups(arr, size) {
var newArray = arr.push();
for (var i = 0; i < arr.length; i++) {
arr = arr.slice(arr, size);
}
return arr;
}
chunkArrayInGroups(["r", "g", "x", "a"], 2);