get query param from string code example
Example 1: get url query params js
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