I used the following code to solve the Chunky Monkey problem in basic algorithm scripting challenges:
var i = 0;
while (i < arr.length/size) {
newArr.push(arr.slice(isize, size + isize));
i++;
}
return newArr;
// The code returns all the answers as required, still I couldn’t pass the test. Can anybody help?