Day 3 is how to split single array based on the size we provide.
for instance single array with 4 value [a,b,c,d]
.
We split it into 2 size [[a,b],[c,d]]
.
so the new array should be has 2 array inside.
There is JavaScript solution
function chunkyMonkey(values, size) { let newArray = []; let index = 0; while(index < values.length) { newArray.push(values.slice(index, index += size)); } return newArray; }
Top comments (0)