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

date,tipjs,function

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

const getDay = (fillFlag=true) => {
  const day = new Date().getDate()
  const dayRe = day
  if (fillFlag) day < 10 ? `0${day}` : day
  return dayRe
}

//Ouput:
console.log(getDay());//27

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

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ì?

Getting the last element of a split string array

Getting the last element of a split string array

Await in a for loop

How to Await in a for loop

Callback in javascript

Callback in 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.