Skip to content

Instantly share code, notes, and snippets.

@YiqinZhao
Created March 9, 2018 07:34
Show Gist options
  • Save YiqinZhao/69f05ed1a8eca67626d9fde5449d6d81 to your computer and use it in GitHub Desktop.
Save YiqinZhao/69f05ed1a8eca67626d9fde5449d6d81 to your computer and use it in GitHub Desktop.
[Split URL Parameters] Simple code for URL parameters split. #web
let result = window.location.href
.split('?')[1]
.split('&')
.map(v => v.split('='))
.reduce((obj, v) => { obj[v[0]] = v[1]; return obj }, {})
console.log(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment