题解 | #参数解析器#
参数解析器
https://www.nowcoder.com/practice/9a4cca8c0779438a8be39d45d0370597
const _getParams = (url) => {
// 补全代码
let dealUrl = new URL(url)
let params = new URLSearchParams(dealUrl.search.slice(1))
let result = {}
for(let key of params.entries()){
result[key[0]] = key[1]
}
return result
}
有没有人说说这是怎么回事,跑的测试是成功的,牛客网好玄学。
#悬赏#