Tell us what’s happening:
I think that I have written a possible solution, which works when I run the code on repl.it, but whenever I try it on the freecodecamp site, it doesn’t work. I have been reviewing the code over and over, but I cannot seem to find the problem. Any ideas? Thanks!
Your code so far
function chunkArrayInGroups(arr, size) {
var twoDimArray = [];
var times = arr.length / size;
var pointer1 = 0;
var pointer2 = size;
for (i = times; i > 0; i--) {
var tempArr = arr.slice(pointer1, pointer2);
twoDimArray.push(tempArr);
pointer1 += size;
pointer2 += size;
} console.log(twoDimArray);
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
.
Link to the challenge:
https://www.freecodecamp.org/challenges/chunky-monkey