Chunky Monkey Challenge works for me but the system won't accept it

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));

return newArr;

// The code returns all the answers as required, still I couldn’t pass the test. Can anybody help?