formToObject
Encodes a set of form elements as an object
.
- Use the
FormData
constructor to convert the HTMLform
toFormData
andArray.from()
to convert to an array. - Collect the object from the array using
Array.prototype.reduce()
.
Encodes a set of form elements as an object
.
FormData
constructor to convert the HTML form
to FormData
and Array.from()
to convert to an array.Array.prototype.reduce()
.