URLSearchParams.delete()

The delete() method of the URLSearchParams interface deletes the given search parameter and all its associated values, from the list of all search parameters.

Note:

This feature is available in Web Workers.

Syntax

URLSearchParams.delete(name)

Parameters

name
The name of the parameter to be deleted.

Return value

Void

Examples

let url = new URL('https://example.com?foo=1&bar=2&foo=3');
let params = new URLSearchParams(url.search);

// Delete the foo parameter.
params.delete('foo'); //Query string is now: 'bar=2'

Specifications

Specification Status Comment
URL
The definition of 'delete()' in that specification.
Living Standard Initial definition.

Browser compatibility

BCD tables only load in the browser