0

Is there any efficient way of getting the number of days in current month using JavaScript ?

Shivank Verma
  • 310
  • 5
  • 18

1 Answers1

1

function _getDates(year, month) {
  return new Date(year, month, 0).getDate(); // 0 + number of days
}
console.log(_getDates(2016, 07))
brk
  • 46,805
  • 5
  • 49
  • 71