Question: how to change query string in javascript?
Answer: // Construct URLSearchParams object instance from current URL querystring. var queryParams = new URLSearchParams(window. location.search); // Set new or modify existing parameter value. queryParams. set("myParam", "myValue"); // Replace current querystring with the new one. history.