URL

URLSearchParams.size

Counts name-value pairs, including repeated names. It is not the number of unique keys. Tested on Node.js 22.16.0. Example output (one line per entry): ["2 1"].

Formal Syntax & Structure

nodejs syntaxnodejs
params.size

Return Value

number

Pair count.

Working Example

Example Snippetnodejs
const p = new URLSearchParams('tag=a&tag=b');console.log(p.size, new Set(p.keys()).size);
Node.js Reference