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());//27Có thể bạn đã miss một số snippets code
try/catch es10
An update for developer convience allows the use of try/catch without an explicit e Error reference in the catch call.
Sử dụng reduce và concat làm phẳng một array
Array.reduce() và Array.concat() có thể giúp chúng ta làm phẳng một Array như:
Remove array of objects from another array of objects
Remove array of objects from another array of objects
Random String
Random String với độ dài tuỳ chọn
flatMap()
Use flatMap() creates a new array with sub-array elements flattened by specified depth.