Web APIs

FormData.has()

Try the free JavaScript compiler

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

NameTypeDescription
namestringField 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"));
JavaScript Reference