Convert query string into object in JavaScript
I suggest you use the standard query string syntax to avoid future problems. Because the weirder this query string gets, the more cases you'll have to add to this piece of code. And when a case that's not covered in your code appears, it will unexpectedly break your code.

Also, this used to be the way to parse query strings (i.e. split by &amp;, loop through the items, split by =). Now, there is a built-in API, URLSearchParams, that parses query strings for you. It exists for both browser JS as well as NodeJS. It exposes several methods as well as methods that return iterables, which allow you to loop through the items.