1
2
3
4
5
6
7
8
let url = 'https://baidu.com?a=1&b=12&c=info'
let getUrlParams = function (URL) {
let url = URL.split('?')[1]
let urlsearchparam = new URLSearchParams(url)
const params = Object.fromEntries(urlsearchparam.entries())
return params
}
console.log(getUrlParams(url))