for (let [key, value] of formData.entries()) {
console.log(`${key}: ${value}`);
}
const formData = new FormData();
formData.append('key1', 'value1');
formData.append('key2', 'value2');
// Display the values
for (const value of formData.values()) {
console.log(value);
}
formData.get('username'); // Returns "Chris"
const formData = {}
Array.from(e.currentTarget.elements).map(item=>{
if (!item.name) return null;
formData[item.name] = item.value
})
console.log(formData)