SyntaxFix
Write A Post
Hire A Developer
Questions
A concise solution:
location.search .slice(1) .split('&') .map(p => p.split('=')) .reduce((obj, pair) => { const [key, value] = pair.map(decodeURIComponent); obj[key] = value; return obj; }, {});