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

Async await in javascript

Async await in javascript

using Typescript callback style error handling

Promise.all là gì?

Promise.all là gì? Hiểu và sử dụng promise all trong những trường hợp nào trong vòng 1 phút.

using javascript callback style error handling

try/catch es10

An update for developer convience allows the use of try/catch without an explicit e Error reference in the catch call.