serialize Form

tipjs,object,es6

Sử dụng formdata constructor để convert form, FormData, array.from(). Kết hợp window.encodeURIComponent() để encode từng value trong form.

const serializeForm = form =>
  Array.from(new FormData(form), field => field.map(encodeURIComponent).join('=')).join('&');
// Sử dụng
serializeForm(document.querySelector('#form')); // email=test%40email.com&name=Test%20Name

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

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

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

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

Random String

Random String với độ dài tuỳ chọn

Merge Array

How to combine two sorted arrays into one? We can do this easily with the spread operator.

Remove item in array javascript es6

Những bạn nào mà đã sử dụng ES6 một thời gian rồi thì có thể sử dụng method array.filter()