The function takes params and url as a parameters. Here you assign the url to variable href inside the function.
The Regex Pattern checks the value that starts with either & or ? followed by the parameter passed. It takes the value after = and stores it in queryString and returns it.
Getting all query strings differs from getting a single query string. Let’s see how you can solve this problem with the help of below code snippet:
Here to create an anchor element and use a property called search in the element. The search property returns the queryString completely.
After creating an anchor element and assigning the url to href, search returns the query strings of url. After doing all this stuff, you can get all the query parameters by splitting the string using the & keyword.