Web APIs
FormData.set()
Replace the entries with this name by one value, or add a new entry if none exists. Example console output: ["green"].
Formal Syntax & Structure
javascript syntaxjavascript
data.set(name, value[, filename])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Field name. |
| value | string or Blob | Entry value. |
| filename | string | Filename for Blob entries. |
Return Value
undefined
No result value.
Working Example
Example Snippetjavascript
const data=new FormData(); data.append("tag","red"); data.append("tag","blue"); data.set("tag","green"); console.log(JSON.stringify(data.getAll("tag")));