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

date,tipjs,function

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

const getMonth = (fillFlag=true) => {
  const mon = new Date().getMonth() + 1
  const monRe = mon
  if (fillFlag) mon < 10 ? `0${mon}` : mon
  return monRe
}
console.log(getMonth());//5

Có thể bạn đã miss một số snippets code

Callback in javascript

Callback in javascript

Ajax, call jQuery POST to node.js expressjs

Ajax, call jQuery POST to node.js expressjs

Object.keys và Object.getOwnPropertyNames

Object.keys và Object.getOwnPropertyNames

Detect when your site is visible to users

Detect when your site is visible to users

Rest Operator for Objects

Now we can use rest on the properties of an Object. It allows us to explicitly extract certain named variables, and assign any uncalled variables into a catchall Object.