javascript query string get code example
Example 1: js query string
const urlParams = new URLSearchParams(window.location.search);
const myParam = urlParams.get('myParam');
Example 2: javascript reading query parameter
// example url: https://mydomain.com/?fname=johnny&lname=depp
const urlParams = new URLSearchParams(window.location.search);
const firstName = urlParams.get('fname'); // johnny