1let params = new URLSearchParams('foo=2'); // "location.search" to read from URL
2
3params.append('bar', 4); //Add a bar parameter.
4console.log(params.toString()); //Prints 'foo=2&bar=4'
5
6location.search = params.toString(); // write changes to URL
7