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

Spread Operator for Objects

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

using Typescript callback style error handling

encode/decode base64 with JS

Encoding to base64 is done with the btoa command

Remove array of objects from another array of objects

Remove array of objects from another array of objects

How to reverse an Array?

Reversing an array in JS is really simple with the standard array method. Like below