How to get query string values using JavaScript?

Here is a very simple method to get query string values using javascript. Below code snippet can be used to fetch the query string value in the URL when the key is provided in...