Web APIs
URLSearchParams.get()
Return the first value with this name, or null if absent. An existing empty value is an empty string. Example console output: a true true.
Formal Syntax & Structure
javascript syntaxjavascript
params.get(name)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Parameter name. |
Return Value
string or null
First matching value or null.
Working Example
Example Snippetjavascript
const p=new URLSearchParams("tag=a&tag=b&empty="); console.log(p.get("tag"),p.get("empty")==="",p.get("missing")===null);