URL
URLSearchParams.append()
Adds another name/value pair without removing existing values. Tested on Node.js 22.16.0. Append raw values, not already percent-encoded strings, to avoid double encoding.
Formal Syntax & Structure
nodejs syntaxnodejs
params.append(name, value)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Parameter name. |
| value | string | Value before URL encoding. |
Return Value
undefined
Mutates the parameter list.
Working Example
Example Snippetnodejs
import { URL, URLSearchParams, fileURLToPath, pathToFileURL } from 'node:url';const p=new URLSearchParams('tag=fiction');p.append('tag','science fiction');console.log(p.toString());