There is no bracket

wondering why there is no bracket on my code?

it is the exact same method as the solution.

  **Your code so far**

function chunkArrayInGroups(arr, size) {

let bigArr = [];
let smArr = [];

//let i = 0;
for(let i = 0; i < arr.length ; i++){
  smArr.push(arr[i]);
  console.log("aaa " + smArr);

  if(i >= size){
    bigArr.push(smArr);
    console.log("bbbb " + bigArr);
    //i = 0;
    smArr = [];
    console.log("ddd " + smArr);
  }
}

console.log("cccc " + bigArr);
return bigArr;


}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36

Challenge: Chunky Monkey

Link to the challenge:

I believe in your console logs it is concatenating the array to your string and thats why no brackets. Only console log bigArr right before your return and you will see why it doesnt pass.

Manually resetting the loop index inside of a for loop is a bad idea.

You’ll have trouble with the scope of smArr (it doesn’t cost anything extra to use full words in your variable names!)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.