CKTIS / JavaScript
URLSearchParams.get — read a query parameter
URLSearchParams.get(name) returns the first parameter value as a string, or null when the parameter is absent.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
params.get(name)params.get(name) reads the first value with the given case-sensitive name. It does not change the parameters. For repeated names, use getAll(name) to retrieve every value.
The result is a string or null. An empty value, such as empty=, produces "", not null.
When parsing a query string, URLSearchParams percent-decodes and converts + to a space; %2B represents a literal plus. get() reads the already-decoded value.
The WHATWG URL Standard defines this API, not an ECMAScript edition. Availability in Node 24 does not establish browser support.
Examples
const params = new URLSearchParams('tag=web&tag=api&q=hello+world&empty=');
console.log(JSON.stringify({
tag: params.get('tag'),
q: params.get('q'),
empty: params.get('empty'),
missing: params.get('missing')
}));Result
{"tag":"web","q":"hello world","empty":"","missing":null}The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.