title: Remove the latest URL parameter after "/"
body: <p>I need to remove any text (or parameters) after the latest "/" in the URL and for that I did this:</p>
  
  <pre><code>var current_url = $(location).attr('href');
  var clean_url = current_url.substring(current_url.lastIndexOf('/') + 1);
  </code></pre>
  
  <p>But it's not working because I get any text (or parameters) after the latest "/" and I don't want that. How? What's wrong in my code?</p>