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

flatMap()

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

Remove array of objects from another array of objects

Remove array of objects from another array of objects

Merge Array

How to combine two sorted arrays into one? We can do this easily with the spread operator.

Getting the last element of a split string array

Getting the last element of a split string array

Convert Array-like to True Array

Convert Array-like to True Array