title: How to get characters from second last index using indexof in javaScript?
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var absoluteURL = "http://stackoverflow.com/users/6262169/vikas-kohli"     
  var n = absoluteURL.lastIndexOf('/');
  var result = absoluteURL.substring(n + 1);
  //alert(result);
  console.log(result);</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here I get the result like 'vikas-kohli' as I am using lastIndexOf.</p>
  
  <p>Now if someone wants to get characters from second last index, or it may be 3rd last index, then how can I get this?</p>
  
  <p>I hope I am able to explain my question well</p>