Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

print all days names of a month js javascript

function getDayNamesInMonth(month, year) {
  let date = new Date(year, month, 1);
  let days = [];
  while (date.getMonth() === month) {
    days.push(new Date(date).toLocaleDateString('en-US', { weekday: 'short' }));
    date.setDate(date.getDate() + 1);
  }
  return dayNames;
}
Source by bobbyhadz.com #
 
PREVIOUS NEXT
Tagged: #print #days #names #month #js #javascript
ADD COMMENT
Topic
Name
8+9 =