SOURCE

const url = new URL("http:www.baidu.com?a=1&b=2")
console.log(url.search) 
const params = new URLSearchParams(url.search.slice(1))

console.log(params.get('a'))
console.log(params.get('c'))

console.log(params.has('a'))

console.log(params.getAll('a'))

params.set('a', 5)
console.log(params.toString())

params.delete('a')
console.log(params.toString())

params.append('a', 4)
console.log(params.toString())

params.sort()
console.log(params.toString())

params.append('a', 6)
console.log(params.toString())

console.log(params.keys())

console.log(params.values())
console 命令行工具 X clear

                    
>
console