Lấy tháng hiện tại trong javascript

date,tipjs,function

Lấy tháng hiện tại trong javascript

const getMonth = (fillFlag=true) => {
  const mon = new Date().getMonth() + 1
  const monRe = mon
  if (fillFlag) mon < 10 ? `0${mon}` : mon
  return monRe
}
console.log(getMonth());//5

Có thể bạn đã miss một số snippets code

10 mẹo sử dụng array và object trong javascript

10 mẹo sử dụng array và object trong javascript

How to reverse an Array?

Reversing an array in JS is really simple with the standard array method. Like below

Object.keys và Object.getOwnPropertyNames

Object.keys và Object.getOwnPropertyNames

Calculate the number of difference days between two dates

Calculate the number of difference days between two dates

Converting Object to an Array

Converting Object to an Array