const url = new URL("http://domain?var=1&var=2&var=3");
const params = Array.from(url.searchParams);
// There is no `.clear()`
for (let param of url.searchParams) {
url.searchParams.delete( param[0] );
}
console.log(url.href) //-> http://domain/?
url.search = url.searchParams.toString();
console.log(url.href) //-> http://domain/
Tested in Chrome and both correctly log the same (second) value.
Tested in Chrome and both correctly log the same (second) value.