Looking for input on my solutions again

You guys are super helpful and I thank you again. I was working on this problem:

I successfully solved the problem, but once again, I found my solution deviated from recommended solutions. Here is mine:

function chunkArrayInGroups(arr, size) {
  let loop =[...arr]
  let ans = []

  for(let i = 0; i < arr.length/size; i++){

   ans.push(loop.splice(0, size))
    }
  return ans;
}

console.log(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 2))

Can someone speak to my code regarding formalities and efficacy?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.