# Array normalization in a calendar in JavaScript

In the previous lessons, you had to make an array of numbers from `1` to the last day of the month:

`let arr = range(getLastDay(year, month));`

Also you have the number of the day of the week for the first day of the month and for the last:

`let firstWeekDay = getFirstWeekDay(year, month); let lastWeekDay = getLastWeekDay(year, month);`

Let's now supplement our array with empty strings on the right and left. Let for this we have the `normalize` function, as the first parameter accepting an array, as the second - how many empty strings to add on the left, and the third - how many empty strings on the right:

`function normalize(arr, left, right) { }`

I remind you that on the left we must add `firstWeekDay` empty elements, and on the right - `6` minus `lastWeekDay` elements. That is, we will use our `normalize` function like this:

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

Implement the described `normalize` function and check its operation.

←→
↑
en ru