Skip to content

Instantly share code, notes, and snippets.

@ih2502mk
Created September 22, 2014 15:53
Show Gist options
  • Save ih2502mk/16d3a3ac506e413c2a0c to your computer and use it in GitHub Desktop.
Save ih2502mk/16d3a3ac506e413c2a0c to your computer and use it in GitHub Desktop.
Oneliner for getting parameters out of location.search
location.search
.slice(1)
.split('&')
.map(function(part) {return part.split('=')})
.reduce(function(acc, pair) {acc[pair[0]] = pair[1]; return acc}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment