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

Copy a string to the clipboard

Copy a string to the clipboard. Only works as a result of user action (i.e. inside a click event listener).

flatMap()

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

Object.keys và Object.getOwnPropertyNames

Object.keys và Object.getOwnPropertyNames

kiểm tra email trong javascript

kiểm tra email trong javascript

JavaScript: async/await with forEach

JavaScript: async/await with forEach()