-
Notifications
You must be signed in to change notification settings - Fork 22.5k
/
index.md
52 lines (37 loc) · 899 Bytes
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: URLSearchParams.delete()
slug: Web/API/URLSearchParams/delete
page-type: web-api-instance-method
tags:
- API
- Method
- URL API
- URLSearchParams
- delete
browser-compat: api.URLSearchParams.delete
---
{{ApiRef("URL API")}}
The **`delete()`** method of the {{domxref("URLSearchParams")}}
interface deletes the given search parameter and all its associated values, from the
list of all search parameters.
{{availableinworkers}}
## Syntax
```js
delete(name)
```
### Parameters
- `name`
- : The name of the parameter to be deleted.
### Return value
None ({{jsxref("undefined")}}).
## Examples
```js
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
{{Specifications}}
## Browser compatibility
{{Compat}}