title: JS Get Second To Last Index Of
body: <p>I am trying to figure out how to get the second to last index of a character in a string.</p>
  
  <p>For example, I have a string like so:</p>
  
  <pre><code>http://www.example.com/website/projects/2
  </code></pre>
  
  <p>I currently get the number <code>2</code> by using </p>
  
  <p><code>$(location).attr('href').substring($(location).attr('href').lastIndexOf('/')+1);</code></p>
  
  <p>But what if I want to get the word <code>projects</code>? </p>
  
  <p>Can anybody help me out with this?  Thanks in advance!</p>