const serialize = (formElement) => { let data = new FormData(formElement); let obj = {}; for (let [key, value] of data) { obj[key] = value; } return obj; }