SOURCE

let getQueryString = function(paramName) {
      let url = document.location.toString();
      let arrObj = url.split("?");
      if (arrObj.length > 1) {
        let arrParam = arrObj[1].split("&");
        let arr;
        for (let i = 0; i < arrParam.length; i++) {
          arr = arrParam[i].split("=");
          if (arr !== null && arr[0] === paramName) {
            return arr[1];
          }
        }
      }
    };

    let foo = getQueryString('foo');
    let bar = getQueryString('bar');
    console.log(foo);
    console.log(bar);
console 命令行工具 X clear

                    
>
console