Tell us what’s happening:
Your code so far
function chunkArrayInGroups(arr, size) {
var temp = [];
var result = [];
for(var i = 0; i < arr.length; i++) {
if (i % size !== size - 1)// i dont understand this line of code please someone explain me
temp.push(arr[i]); //temp ab
else {
temp.push(arr[i]);//tempa a
result.push(temp);//
temp = [];//
}
}
if (temp.length !== 0)
result.push(temp);
return result;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/chunky-monkey