var url = ‘https://gitbook.cn/gitchat/geekbooks?tag=JavaScript&name=pwwu&age=24‘; var temp1 = url.split(‘?‘); var pram = temp1[1]; var keyValue = pram.split(‘&‘); var obj = {}; for (var i = 0; i<keyValue.length; i++){ var item = keyValue[i].split(‘=‘); var key = item[0]; var value = item[1]; obj[key] = value; } console.log(url); console.log(temp1); // [‘https://gitbook.cn/gitchat/geekbooks‘,‘tag=JavaScript&name=pwwu&age=24‘] console.log(pram); // tag=JavaScript&name=pwwu&age=24 console.log(keyValue); // [‘tag=JavaScript‘,‘name=pwwu‘,‘age=24‘] console.log(obj); // {tag:‘JavaScript‘,name:‘pwwu‘,age:‘24‘}