Web APIs
FormData.has()
Check whether at least one entry has the supplied name, even if its value is empty. Example console output: true false.
Formal Syntax & Structure
javascript syntaxjavascript
data.has(name)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Field name. |
Return Value
boolean
Whether the entry exists.
Working Example
Example Snippetjavascript
const data=new FormData(); data.append("note",""); console.log(data.has("note"),data.has("unknown"));