题解 | #参数解析器#
参数解析器
https://www.nowcoder.com/practice/9a4cca8c0779438a8be39d45d0370597
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> </head> <body> <script> const _getParams = (url) => { // 补全代码 let arr = (url.split('?')[1]).split('&') let res = {} for(let i = 0; i < arr.length; i++) { const [key, value] = arr[i].split('='); res[key] = value } return res } </script> </body> </html>