CKTIS / JavaScript
URLSearchParams — query parameters
URLSearchParams reads and modifies query parameters, preserving repeated names and handling form-style encoding.
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
new URLSearchParams()
new URLSearchParams(init)
params.get(name)
params.getAll(name)
params.append(name, value)
params.set(name, value)
params.toString()URLSearchParams is a WHATWG URL API, not ECMAScript. Its constructor accepts a query (optionally starting with ?), a record, or name–value pairs; it does not parse a full URL.
get() returns the first value or null; getAll() returns all values. append() adds a pair. If the given name already exists, set() updates the value of the first pair with that name and removes any other pairs with the same name. If the name does not exist, set() appends a new pair.
toString() omits ? and uses application/x-www-form-urlencoded: spaces become +, literal plus signs become %2B. Pass unencoded values to methods.
Mutating url.searchParams updates its associated URL and can change its encoding. The standard is not a browser compatibility table; Node 24 does not prove browser support.
Examples
const params = new URLSearchParams("tag=js&tag=web");
console.log(params.getAll("tag").join(","));
params.set("tag", "api");
params.append("q", "a+b c");
console.log(params.toString());Result
js,web tag=api&q=a%2Bb+c
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.