I want to change the parameters of a url and put the changed url into a variable, but it is undefined. Is there any way to put the url with the parameter changed into a variable? I have tried the following.
const url = new URL(window.location.href);
const params = new URLSearchParams(url.search.slice(1));
const aUrl = params.set('link','abc');