title: How to substring a string in an array in Javascript
body: <p>I have function that uses a 'for loop' to find a url. Because the 'for loop' is looping over the  DOM array for links, each link is placed at an array index. </p>
  
  <p>The url will look like this: <a href="http://reporter.highschoolsports-555.masslive.com/news/article/4040274705063720904/title287393467/" rel="nofollow">http://reporter.highschoolsports-555.masslive.com/news/article/4040274705063720904/title287393467/</a></p>
  
  <p>I need to cut off the beginning of the url to look like this: highschoolsports-555.masslive.com/news/article/4040274705063720904/title287393467/</p>
  
  <p>When I use substring to remove the beginning of the url, I get an error, "function substr does not exist"</p>
  
  <p>Is there a way to serialize or convert the array index data into a string to that I can use substring to edit the url? </p>
  
  <pre><code>var grabLinkFromList;    
  var grablink= function(){
  
      var links=document.links;
      for (var i=0;i&lt;30;i++){
      console.log("index "+i+" Link "+links[i]); 
      if(i==23){
          grabLinkFromList=links[i];
  
          var substringURL=grabLinkFromList.substr(0,15);
          alert(substringURL);
          }
  }
  </code></pre>
  
  <p>I've also used this version of substring too:</p>
  
  <pre><code>var grabLinkFromList;    
  var grablink= function(){
  
      var links=document.links;
      for (var i=0;i&lt;30;i++){
      console.log("index "+i+" Link "+links[i]); 
      if(i==23){
          grabLinkFromList=links[i];
  
          var substringURL=grabLinkFromList.substring(0,15);
          alert(substringURL);
          }
  }
  </code></pre>