serializeForm
Encodes a set of form elements as a query string.
- Use the
FormDataconstructor to convert the HTMLformtoFormData. - Use
Array.from()to convert to an array, passing a map function as the second argument. - Use
Array.prototype.map()andencodeURIComponent()to encode each field's value. - Use
Array.prototype.join()with appropriate arguments to produce an appropriate query string.