new formdata().append
时间: 2023-10-21 07:11:38 浏览: 40
The `FormData()` constructor creates a new instance of the `FormData` object, which is used to represent a set of key/value pairs that correspond to form fields and their values.
The `.append()` method is used to add a new key/value pair to the `FormData` object. It takes two arguments - the first argument is the name of the form field, and the second argument is the value of the form field.
For example, the following code creates a new `FormData` object and adds two form fields to it:
```
const formData = new FormData();
formData.append('username', 'john.doe');
formData.append('password', 'mypassword');
```
This would create a `FormData` object with two key/value pairs:
```
{
"username": "john.doe",
"password": "mypassword"
}
```