title: Javascript for loop variable not working
body: <p>I am having a problem with my for loop inside a javascript function. The variable <code>i</code> is not working as an argument for the function <code>showAlbum(i)</code>. Why is that happening? </p>
  
  <pre class="lang-js prettyprint-override"><code>var out = "&lt;table&gt;";
  for(i = 0; i &lt; arr.length; i++) {
              out += "&lt;tr&gt;&lt;td&gt;&lt;a href=''onclick='showAlbum(i);' &gt;"+
                  arr[i].artist +
                  " - " +
                  arr[i].title +
                  "&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";
          }
  out += "&lt;/table&gt;";
  </code></pre>