Friday, September 5, 2025
HomeLanguagesJavascriptNode.js URLSearchParams.delete()

Node.js URLSearchParams.delete()

In URLSearchParams interface, the delete() method deletes the parameter specified by user and all its associated values.

Syntax:

URLSearchParams.delete(name)

Parameters:
name – The name of the parameter to be deleted.

Example 1:




let params = new URLSearchParams(url.search.slice(1));
  
// Delete the par parameter.
params.delete('par');
console.log(url)


Output:

https://example.com?bar=2

Example 2:




let url = new URL('https://example.com?foo=1&par=3');
let params = new URLSearchParams(url.search.slice(1));
  
// Delete the foo parameter.
params.delete('foo');
console.log(url)


Output:

https://example.com?par=3

Supported Browsers:

  • Google Chrome
  • IE
  • Edge
  • Opera
  • Apple Safari
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11861 POSTS0 COMMENTS
Shaida Kate Naidoo
6750 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6699 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS