正则表达式相关的JS。
function formatUrlQuery() { const urlParams = window.location.search; if (!urlParams) { return null; } const keys = {}; urlParams.replace(/([^?=&]+)=([^&]*)/g, (full, key, value) => { keys[key] = value; }); return keys; }
← Dom Skill 代码片段 →