Web APIs
URLSearchParams.has()
Check for a parameter name, optionally requiring the supplied value too. Example console output: true false.
Formal Syntax & Structure
javascript syntaxjavascript
params.has(name[, value])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Parameter name. |
| value | string | Matching value if specified. |
Return Value
boolean
Whether a matching pair exists.
Working Example
Example Snippetjavascript
const p=new URLSearchParams("tag=a&tag=b"); console.log(p.has("tag","b"),p.has("tag","c"));