In JavaScript we can access window/browser properties using window object. This can be helpful when dealing with query string.
Here is a quick example how you can access the URL of the current page in JavaScript
cost url =widnow.location.href
console.log(url)
Out Put
http://wordpress.com