In this solution I was accessing multidimensional array directly. I realized that the first dimension had to be initialized first, otherwise it would throw TypeError.
chunk(arr, size = 1) {
//for size equal to array length, we keep as is.. not clear from the instructions
if (size === arr.length)
return arr
let newarr = []
for (let i=0; i<arr.length/size;i++)
newarr[i] = []
for (let i=0; i<arr.length; i++)
newarr[Math.floor(i/size)][i%size] = arr[i]
return newarr
}