Last active
September 26, 2017 06:30
-
-
Save ifedyukin/d0a3545ff3d3b276fcda7af6c1e1d57b to your computer and use it in GitHub Desktop.
Get params from url - javascript - ES6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.document.location.search | |
.slice(1) | |
.split('&') | |
.reduce((acc, param) => { | |
const [name, value] = param.split('='); | |
acc[name] = value; | |
return acc; | |
}, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment