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.
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.