const formData = {} Array.from(e.currentTarget.elements).map(item=>{ if (!item.name) return null; formData[item.name] = item.value }) console.log(formData)