title: How can I delete a query string parameter in JavaScript?
body: <p>Is there better way to delete a parameter from a query string in a URL string in standard JavaScript other than by using  a regular expression?</p>
  
  <p>Here's what I've come up with so far which seems to work in my tests, but I don't like to reinvent querystring parsing!</p>
  
  <pre><code>function RemoveParameterFromUrl( url, parameter ) {
  
      if( typeof parameter == "undefined" || parameter == null || parameter == "" ) throw new Error( "parameter is required" );
  
      url = url.replace( new RegExp( "\\b" + parameter + "=[^&amp;;]+[&amp;;]?", "gi" ), "" ); "$1" );
  
      // remove any leftover crud
      url = url.replace( /[&amp;;]$/, "" );
  
      return url;
  }
  </code></pre>