Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

URLSearchParams.delete(): removing query parameters

URLSearchParams.delete() removes every pair with a given name, or only pairs matching both the supplied name and value.

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.delete(name)
params.delete(name, value)

params.delete(name) removes every pair named name, including duplicates. params.delete(name, value) removes every pair matching both the name and value, not just the first.

The method mutates the object and returns undefined, not a removal count. No match causes no error. For an object obtained through url.searchParams, it also updates that URL's query.

This API belongs to the WHATWG URL standard, not a particular ECMAScript edition. Check support for the value form in your target runtime; Node 24 in a repository alone does not establish browser support.

Examples

const params = new URLSearchParams('tag=js&tag=web&tag=js&page=2');
params.delete('tag', 'js');
console.log(params.toString());
params.delete('tag');
console.log(params.toString());

Result

tag=web&page=2
page=2

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