Conversion of an array into two-dimensional in a calendar in JavaScript

In the previous lesson, we made an array filled on the right and left with empty strings. Let's now convert this array into a two-dimensional one. Let's make the following chunk function for this:

function chunk(arr, n) { // n - a number of elements in subarray }

You can use our function like this:

let res = chunk(normalize(arr, firstWeekDay, 6 - lastWeekDay), 7)); console.log(res);

Implement the described function chunk and check its operation.