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
serialize Form
Sử dụng formdata constructor để convert form, FormData, array.from(). Kết hợp window.encodeURIComponent() để encode từng value trong form.
Ajax, call jQuery POST to node.js expressjs
Ajax, call jQuery POST to node.js expressjs
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.
closure javascript
closure javascript
encode/decode base64 with JS
Encoding to base64 is done with the btoa command