What is the algorithm of filling the calendar with days of the month?

Hi guys.
See I have a calendar, I only need to fill it with numbers, but that would still display the number from the previous month and not the blank cells. Can tell the algorithm how to do, and that is something I can't do it?

Tried so
var last = new Date(firstDateAtMonth.getTime() - (allDaysInMonth * 24 * 60 * 60 * 1000));
var lastDay = last.getDate();
 calendarHTML += lastDay;

The calendar itself

Code to fill in at line number 52
June 10th 19 at 16:35
2 answers
June 10th 19 at 16:37
On request in Google "javascript calendar print" a lot of results, study. For example
or here
Okay, thanks for the tip. - ludwig33 commented on June 10th 19 at 16:40
June 10th 19 at 16:39
Fixed your calendar. https://codepen.io/rockoff/pen/rYXKyp?editors=0011
Look into js strings to c 15 by 20, with 51 at 60. And in css 8049
God is all to simplicity just. Thank You!! - ludwig33 commented on June 10th 19 at 16:42

Find more questions by tags JavaScript