Function for a calendar formation in JavaScript

Let's wrap the calendar formation code in a function:

function draw(body, year, month) { 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) }

In this case, we will be able to draw the calendar like this:

let date = new Date(); let year = date.getFullYear(); let month = date.getMonth(); draw(body, year, month)

Do as described.

enru