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

promise in javascript

promise in javascript

flatMap()

Use flatMap() creates a new array with sub-array elements flattened by specified depth.

Hàm lày ngày trong tuần javascript

Hàm lày ngày trong tuần javascript

using javascript callback style error handling

Convert Array-like to True Array

Convert Array-like to True Array