Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get number of days in a month javascript

function getDaysInMonth(year, month) {
  return new Date(year, month, 0).getDate();
}
Comment

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;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: fetch api in js 
Javascript :: js regex replace multiple matches 
Javascript :: useeffect only on mount 
Javascript :: inc a value mongoose 
Javascript :: updating a key value on javascript object es6 
Javascript :: javascript get child element by parent id 
Javascript :: upload image react 
Javascript :: what is jsx in react 
Javascript :: javascript pseudo random 
Javascript :: move canvas element to mouse 
Javascript :: json.stringify vs json.parse 
Javascript :: new line javascript 
Javascript :: javascript count no of lines 
Javascript :: js check if two arrays contain same values 
Javascript :: regex expression to match domain name 
Javascript :: js execute string 
Javascript :: javascript count number of occurrences in array of objects 
Javascript :: regex remove duplicates 
Javascript :: how to send a request to a web server javascript 
Javascript :: countdown in js 
Javascript :: display console log in HTML 
Javascript :: create a json object in javascript 
Javascript :: format date javascript 
Javascript :: regex find first instace 
Javascript :: dotenv not loading process.env in node 
Javascript :: jquery parent 
Javascript :: anagram javascript example 
Javascript :: what is virtual dom in react 
Javascript :: Moment.js: Date between dates 
Javascript :: inline styling in react 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =