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

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

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

Đếm có bao nhiêu items giống nhau trong một array

reduce javascript. Đếm có bao nhiêu items giống nhau trong một array

So sánh hai array trong javascript

Làm thế nào để đánh giá xem hai mảng có bằng nhau không? Có hai cách đó là sử dụng JSON.stringify() hoặc toString()

Merge Array

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

try/catch es10

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