Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

URLSearchParams.getAll(): all values of a parameter

getAll(name) returns an array of every query parameter value with the specified name, preserving order and duplicates.

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.getAll(name)

params.getAll(name) returns an array of strings for the specified parameter name. It preserves order and duplicates; name matching is case-sensitive.

A missing name produces [], whereas a present parameter with an empty value produces [""]. In contrast, get(name) returns only the first value or null.

The result is a separate array: modifying it does not change the parameters. This is a Web API method defined by the URL Standard, not a feature of a particular ECMAScript edition. Check availability in your target environment; Node 24 does not establish browser support.

Examples

const params = new URLSearchParams('tag=js&tag=web&tag=js&empty=');
console.log(JSON.stringify(params.getAll('tag')));
console.log(JSON.stringify(params.getAll('missing')));
console.log(JSON.stringify(params.getAll('empty')));

Result

["js","web","js"]
[]
[""]

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources