I really confused about this question and answer, like the line of " if (a % size !== size - 1) temp.push(arr[a]);",and I checked the output with console.log, it turns out " [(2)[…],(2)[…]]", this is the right answer that he wants? Anybody can help me with this? Thanks!

Question goes like this:
Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a two-dimensional array.

**Your code so far**

function chunkArrayInGroups(arr, size) {
let temp = [];
let result = [];
for (let a = 0; a < arr.length; a++) {
if (a % size !== size - 1) temp.push(arr[a]);
else {
temp.push(arr[a]);
result.push(temp);
temp = [];
}
}
if (temp.length !== 0) result.push(temp);
return result;
}
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/100.0.4896.88 Safari/537.36

So here you need to split the array first into chunks of size. For that, you need to divide arr.length by size. Make sure you do integer division to avoid problems. You will get a quotient and remainder. Take size number of elements quotient times from the original array . Those quotient number of arrays will be the first few arrays in the final array. And then if there is any remainder on division, then those number of remaining elements should be put into a new array and pushed in the final array.

It’s saying that you have an array with two items. Each of those two items is itself a an array of two items. The console has decided that the inner arrays are too long to show so it is showing the contents with an ellipsis. Different environments make different decisions about what to show in different situations. JS is just sending a reference to an object and the console is deciding what and how to show it.

If you want to ensure to show it all, you can convert it to a string: