题解 | #参数解析器#
参数解析器
https://www.nowcoder.com/practice/9a4cca8c0779438a8be39d45d0370597
const _getParams = (url) => {
return {[url.match(/.*?([a-z]*)=/)[1]]:url.match(/.*=(\S*)&/)[1],
[url.match(/.*&(\S*)=/)[1]]:url.match(/.*&.*=(\d*)/)[1]};
}
参数解析器
https://www.nowcoder.com/practice/9a4cca8c0779438a8be39d45d0370597
const _getParams = (url) => {
return {[url.match(/.*?([a-z]*)=/)[1]]:url.match(/.*=(\S*)&/)[1],
[url.match(/.*&(\S*)=/)[1]]:url.match(/.*&.*=(\d*)/)[1]};
}
相关推荐