题解 | #参数解析器#
参数解析器
https://www.nowcoder.com/practice/9a4cca8c0779438a8be39d45d0370597
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<script>
const _getParams = (url) => {
// 补全代码
const res = {}
url.replace(/([^?&]+)=([^&]+)/g,(match,p1,p2) => {
res[p1] = p2
})
return res
}
</script>
</body>
</html>
查看8道真题和解析
