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

Extend Object javascript

Extend Object javascript

await axios get

await axios get

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

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

Spread Operator for Objects

Using the spread operator during an Object declaration will assign the properties of the referenced Object to the new Object.

try/catch es10

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