79386141

Date: 2025-01-25 03:50:53
Score: 0.5
Natty:
Report link

When you use the spread operator (...) on a FormData iterable, it converts the iterable into an array of key-value pairs which is called (entries). You can then use Object.fromEntries() to transform these entries into a plain object.

const myForm = new FormData()
myForm.set("name", "Ram")
const myFormDataObj = Object.fromEntries([...myForm])

console.log(myFormDataObj) // Output: { name: "Ram" }
Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): When you use the
  • Low reputation (0.5):
Posted by: Ram Farid