Tell us what’s happening:
My code works, but it is different than any of the solutions. At this point in my learning, does it matter that I use the best performing method? How do I know what the best performing method is?
Your code so far
function chunkArrayInGroups(arr, size) {
let newArray = [];
for (let i=0; i<arr.length; i+=size) {
newArray[i/size] = (arr.slice(i,i+size));
}
return newArray;
}
chunkArrayInGroups([0, 1, 2, 3, 4, 5, 6, 7, 8], 2);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15
.
Challenge: Chunky Monkey
Link to the challenge: