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());//5Có thể bạn đã miss một số snippets code
Random String
Random String với độ dài tuỳ chọn
How to reverse an Array?
Reversing an array in JS is really simple with the standard array method. Like below
Await in a for loop
How to Await in a for loop
flatMap()
Use flatMap() creates a new array with sub-array elements flattened by specified depth.
Chuyển đổi thời gian trong javascript
Sử dụng Object.entries(), Array.prototype.filter() và Array.prototype.map(). Trả về định dạng ngày, giờ, phút với một miliseconds đã cho.