Programming Tips - javaScript: get querystring (URL) parameter

Date: 2020jan9 Language: javaScript Q. javaScript: get querystring (URL) parameter A.
function getQsParams() { var params = {}; const pairs = document.location.search.substr(1).split('&'); for (var i = 0; i < pairs.length; i++) { if (pairs[i] == '') continue; const a = pairs[i].split('='); params[a[0]] = a[1]; }; return params; } function exampleUse() { const params = getQsParams(); const userid = params['userid']; console.log('userid=' + userid); }
I looked, jQuery doesn't seem to have a function for this. There doesn't seem to be