**Tell us what’s happening:**

Hey everyone,

I have tried multiple solutions to this, using loops and redundant formulas.

I checked them all in console, with debugger, and they all worked for me, yet all answers return as incorrect. Could someone point me in the right direction?

thanks in advance!

*your code so far*

```
//set a global var for answer array
var ansArr = [];
function chunkArrayInGroups(arr, size) {
//call newly created redundancy function
chunks(arr,size);
//return ansArr
return ansArr;
}
//create redundancy formula with two parameters
function chunks(arr, size) {
//duplicate the array so I am not changing the original array, not necessary but good practice.
var arrCopy = arr.slice();
//test if copied array is longer or the same length as the sizes parameters
if(arrCopy.length>=size){
// if conditional is true push a splice of array copy to ansArr
ansArr.push(arrCopy.splice(0,size));
//rerun function with arrCopy passed in to the arr parameter.
chunks(arrCopy,size);
}
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
```

Here is the version of for loops I wrote, I like the redundancy formula a bit more, I just think it would be fast than having a double loop, but the below should still be a viable solution…

//I don’t have this commented out, and I didn’t copy the original array since I added that step later after thinking about it, but if you have any questions I am more than happy to answer them.

```
var ansArr = [];
function chunkArrayInGroups(arr, size) {
var temp = [];
for (i=0; i<=arr.length/size;i++){
for(j=0;j<size;j++){
temp.push(arr[0]);
arr.shift();
}
ansArr.push(temp);
temp =[];
}
return ansArr;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
```

**Your browser information:**

```
Your Browser User Agent is: ```Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8```.
**Link to the challenge:**
https://www.freecodecamp.org/challenges/chunky-monkey
```