title: How to get last folder name from folder path in javascript?
body: <p>In javascript/jquery, given a path to a folder like:</p>
  
  <pre><code>"http://www.blah/foo/bar/" 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>"http://www.blah/foo/bar" (this one doesn't have a slash in the end)
  </code></pre>
  
  <p>How can you extract the name of the last folder? In this case it would be <code>"bar"</code>.</p>
  
  <p>Is there an easy way through a built in function?</p>
  
  <p>Thanks.</p>