title: Returning values out of for loop in javascript
body: <p>I have the following function:</p>
  
  <pre><code>  function getId(a){
      var aL = a.length;
      for(i = 0; i &lt; aL; i++ ){
        return a[i][2].split(":", 1)[0];
      }    
    }                          
  </code></pre>
  
  <p>and when using <code>console.log()</code> within the function instead of <code>return</code> I get all of the values in the loop, and the same goes for <code>document.write</code>.  How can I access these values as a string for use in another section of my code?</p>
  
  <p>Thank you in advance.</p>