Sometimes, we want to debug FormData.append("key", "value") is not working with JavaScript.
In this article, we’ll look at how to debug FormData.append("key", "value") is not working with JavaScript.
How to debug FormData.append("key", "value") is not working with JavaScript?
To debug FormData.append("key", "value") is not working with JavaScript, we can loop through the values with a loop.
For instance, we write
for (const data of formData) {
console.log(data);
}
to loop through the entries of the formData FormData object with a for-of loop.
In it, we log the data value.
This works because a FormData object is an iterable object.
Conclusion
To debug FormData.append("key", "value") is not working with JavaScript, we can loop through the values with a loop.