javascript urlparameter is not defined boolean code example
Example 1: js get url parameter
var url_string = "http://www.example.com/t.html?a=1&b=3&c=m2-m3-m4-m5";
var url = new URL(url_string);
var c = url.searchParams.get("c");
console.log(c);
Example 2: javascript get parameter
let params = {};
window.location.search.slice(1).split('&').forEach(elm => {
if (elm === '') return;
let spl = elm.split('=');
const d = decodeURIComponent;
params[d(spl[0])] = (spl.length >= 2 ? d(spl[1]) : true);
});
params['foo']
params['best food']