Tell us what’s happening:
I have no tool to get the value of ‘newarr’. Is there anyone who could tell me what ‘newarr’ will be in the end?
Your code so far
function chunkArrayInGroups(arr, size) {
var newarr=[];
var tmp=[];
for(var i=0;i<arr.length-size;i+=size){
tmp=arr.slice(i,i+size-1);
newarr.push(tmp);
}
tmp=arr.slice(i,arr.length-1);
newarr.push(tmp);
return newarr;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.146 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/chunky-monkey