Creation of a table in a calendar in JavaScript

Let's now make the createTable function, as the first parameter accepting a reference to the parent element of the calendar numbers (in our case it will be tbody), and as the second - a two-dimensional array:

function createTable(parent, arr) { }

Let's use the function as follows:

let arr = range(getLastDay(year, month)); let firstWeekDay = getFirstWeekDay(year, month); let lastWeekDay = getLastWeekDay(year, month); let nums = chunk(normalize(arr, firstWeekDay, 6 - lastWeekDay), 7); createTable(body, nums)

Implement the described createTable function.

Put all the code together and display the calendar for the current month.

enru