Just have a look at the following simple code.
URL will be split into parts based on the type of separators you are given in the function.
In this example we gave ('?', '&')
In forEach loop we are checking for the key and value pairs.
Those should be
key1 = firstValue
value1 = name
key2 = secondValue
value2 = email
We are alerting the result that generated here.
For any queries please comment in the bellow comment section.
For more interesting and useful code snippets please follow our blog.