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
formatdate js
JavaScript’s Date() function object contains a long list of methods that can be used to manipulate the date outcome
String.prototype.trimEnd
trimEnd() Phương thức xóa khoảng trắng từ đầu chuỗi và trả về một chuỗi mới. Có nghĩa là trimEnd() xoá những ký tự space bên phải mà không làm thay đổi chuỗi gốc.
Làm phẳng mảng dùng phương pháp đệ quy
Làm phẳng mảng dùng phương pháp đệ quy
flatMap()
Use flatMap() creates a new array with sub-array elements flattened by specified depth.
Merge Array
How to combine two sorted arrays into one? We can do this easily with the spread operator.