Though URLSearchParams works well for the usecase. i wanted to get all the query strings from the url which is difficult in URLSearchParams(from what i know). i wanted to write a custom function that i can use to get all query strings in the url.
Didn't tried out but it seems that URLSearchParams offers iterator to get all query strings.
From the doc:
URLSearchParams.entries()
Returns an iterator allowing iteration through all key/value pairs contained in this object.
URLSearchParams.keys()
Returns an iterator allowing iteration through all keys of the key/value pairs contained in this object.
Though URLSearchParams works well for the usecase. i wanted to get all the query strings from the url which is difficult in URLSearchParams(from what i know). i wanted to write a custom function that i can use to get all query strings in the url.
Didn't tried out but it seems that URLSearchParams offers iterator to get all query strings.
From the doc:
Found out an example too: davidwalsh.name/query-string-javas...
That being said, the good point of your method is that it is compatible with Internet Explorer 😉
Cool.. Thanks for the update. i will add this in article.