Web APIs

URLSearchParams.get()

Try the free JavaScript compiler

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

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