Skip to content

Instantly share code, notes, and snippets.

@ifedyukin
Last active September 26, 2017 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ifedyukin/d0a3545ff3d3b276fcda7af6c1e1d57b to your computer and use it in GitHub Desktop.
Save ifedyukin/d0a3545ff3d3b276fcda7af6c1e1d57b to your computer and use it in GitHub Desktop.
Get params from url - javascript - ES6
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