Answers for "js remove query param from url"

0

js remove query param from url

if (typeof URLSearchParams !== 'undefined') {
  const params = new URLSearchParams('param1=1&param2=2&param3=3')
  
  console.log(params.toString())
  
  params.delete('param2')
  
  console.log(params.toString())

} else {
  console.log(`Your browser ${navigator.appVersion} does not support URLSearchParams`)
}
Posted by: Guest on March-24-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language