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

Random Number javascript

Random Number javascript

Sự khác biệt giữa substr và substring

Sự khác biệt giữa substr() và substring() chức năng trong JS là gì?

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

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

try/catch es10

An update for developer convience allows the use of try/catch without an explicit e Error reference in the catch call.

Ajax, call jQuery POST to node.js expressjs

Ajax, call jQuery POST to node.js expressjs