const url = 'http://www.baidu.com/we/index.html?id=098&aaa=123&ccc=456'
function Param(url) {
let arr = url.split('?')[1].split('&')
console.log(arr);
let obj = {}
arr.forEach(item => {
console.log(item.split('='));
let [key, value] = item.split('=')
if (/^\d+$/.test(value)) {
value = parseInt(value)
}
obj[key] = value
})
return obj
}
console.log(Param(url));
07-29
1620